Skip to content
Open

ddnn #676

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 50 additions & 2 deletions src/books.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,76 @@
// 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);



// Iteration 4 | Estimated Reading Time
// 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

Expand Down