Device Sync
This commit is contained in:
@@ -1,63 +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
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user