Skip to content

Instantly share code, notes, and snippets.

@appoll
Created June 4, 2021 18:27
Show Gist options
  • Save appoll/0b17bb07a9e98f0b52e54456a9c9bd78 to your computer and use it in GitHub Desktop.
Save appoll/0b17bb07a9e98f0b52e54456a9c9bd78 to your computer and use it in GitHub Desktop.
let book1 = {
pages: 200,
year: 2022,
authors:
[
{
firstName: "Paul",
lastName: "Anton"
},
{
firstName: "Jannek",
lastName: "JJ"
}
],
format: "A4",
title: "Javascript. WHY?"
}
console.log(book1.authors[1].firstName)
// E0: try it with your own book object
// 0.1 add 2 properties to the book object: one number (e.g. numberPages) and one boolean (e.g. germanLanguage)
// 0.2 add one author to the list of authors
// 0.3 iterate through the list of the books' authors and print their Firstnames
// 0.4 print how many authors this book has
// create a second book object, book2
// 0.5 write a function getPageCount(book) that takes a book as a parameter and returns the number of pages;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment