diff --git a/src/books.js b/src/books.js index c8119bb..20112fb 100644 --- a/src/books.js +++ b/src/books.js @@ -40,20 +40,63 @@ // Your code here: const booksArray = []; - +const booksArray = [ + { + title: "The Old Man and the Sea", + pages: 128, + author: "Ernest Hemingway", + details: { + language: "English", + description: "One of Hemingway's most famous works..." + } + }, + { + title: "The Airbnb Story", + pages: 256, + author: "Leight Gallagher", + details: { + language: "English", + description: "Story of Airbnb..." + } + }, + { + title: "Educated - A Memoir", + pages: 352, + author: "Tara Westover", + details: { + language: "English", + description: "Struggle for self-invention..." + } + }, + { + title: "The Art of Learning", + pages: 288, + author: "Josh Waitzkin", + details: { + language: "English", + description: "Journey to excellence..." + } + } +]; // Iteration 2 | Book Details function getBookDetails() { // Your code here: - +function getBookDetails(book) { + return `${book.title} - ${book.author} - ${book.pages} pages`; +} } // Iteration 3 | Delete Language // Your code here: +booksArray.forEach(book => { + delete book.details.language; +}); +console.log(booksArray); @@ -61,7 +104,12 @@ function getBookDetails() { // Your code here: +booksArray.forEach(book => { + const readingTime = Math.ceil((book.pages * 500) / 90); + book.readingTime = readingTime; +}); +console.log(booksArray); // Bonus: Iteration 5 | Books Dictionary