Some practice
This commit is contained in:
Binary file not shown.
11
INFO-1272 (JS 1)/Notes/Week 8/index.html
Normal file
11
INFO-1272 (JS 1)/Notes/Week 8/index.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Week 8 JS Object Practice</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Week 8 JS Object Practice</h1>
|
||||||
|
<script src="index.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
63
INFO-1272 (JS 1)/Notes/Week 8/index.js
Normal file
63
INFO-1272 (JS 1)/Notes/Week 8/index.js
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
// Question 1
|
||||||
|
function person(firstName, lastName, age, city) {
|
||||||
|
return {
|
||||||
|
firstName: firstName,
|
||||||
|
lastName: lastName,
|
||||||
|
age: age,
|
||||||
|
city: city
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var testPerson = person("Levi", "McLean", 20, "Woodstock");
|
||||||
|
console.log(testPerson.firstName);
|
||||||
|
console.log(testPerson.lastName);
|
||||||
|
console.log(testPerson.age);
|
||||||
|
console.log(testPerson.city);
|
||||||
|
|
||||||
|
// Question 2
|
||||||
|
function book(title, author, pages) {
|
||||||
|
return {
|
||||||
|
title: title,
|
||||||
|
author: author,
|
||||||
|
pages: pages
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var testBook = book("1984", "George Orwell", 386);
|
||||||
|
console.log(testBook.title);
|
||||||
|
console.log(testBook.author);
|
||||||
|
console.log(testBook.pages);
|
||||||
|
console.log("Update pages to 555");
|
||||||
|
testBook.pages = 555;
|
||||||
|
console.log(testBook.pages);
|
||||||
|
|
||||||
|
// Question 3
|
||||||
|
function movie(name, year, rating) {
|
||||||
|
return {
|
||||||
|
name: name,
|
||||||
|
year: year,
|
||||||
|
rating: rating
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var testMovie = movie("Kill Bill", 2003, 9.5);
|
||||||
|
console.log(testMovie.name);
|
||||||
|
console.log(testMovie.year);
|
||||||
|
console.log(testMovie.rating);
|
||||||
|
console.log("Adding new property director");
|
||||||
|
testMovie.director = "Quentin Tarantino";
|
||||||
|
console.log(testMovie.director);
|
||||||
|
|
||||||
|
// Question 4
|
||||||
|
const playlist = {
|
||||||
|
name: "Cool Jams",
|
||||||
|
songs: ["Rap song", "Metal song", "Pop song"]
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log(playlist.songs);
|
||||||
|
console.log("First Song");
|
||||||
|
console.log(playlist.songs[0]);
|
||||||
|
console.log("Last Song");
|
||||||
|
console.log(playlist.songs[playlist.songs.length - 1]); // Always get last entry
|
||||||
|
|
||||||
|
// Question 5
|
||||||
1965
INFO-1274 (Graphic Design)/Labs/Lab 7/Ball and Tee.ai
Normal file
1965
INFO-1274 (Graphic Design)/Labs/Lab 7/Ball and Tee.ai
Normal file
File diff suppressed because one or more lines are too long
3561
INFO-1274 (Graphic Design)/Labs/Lab 7/Restaurant Logo.ai
Normal file
3561
INFO-1274 (Graphic Design)/Labs/Lab 7/Restaurant Logo.ai
Normal file
File diff suppressed because one or more lines are too long
3693
INFO-1274 (Graphic Design)/Labs/Lab 7/Restaurant Logo_McLean.ai
Normal file
3693
INFO-1274 (Graphic Design)/Labs/Lab 7/Restaurant Logo_McLean.ai
Normal file
File diff suppressed because one or more lines are too long
BIN
INFO-1274 (Graphic Design)/Labs/Lab 7/Restaurant Logo_McLean.pdf
Normal file
BIN
INFO-1274 (Graphic Design)/Labs/Lab 7/Restaurant Logo_McLean.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user