Create an isBookRead function that receives a list of books and a title, and returns whether that book has been read or not. A book is an object with title as a string and isRead as a boolean. If the book does not exist, return false.
TIP: There is an Array.prototype method that will help you search by pattern.
function isBookRead(books, titleToSearch) {
// Implementation here
}const books = [
{ title: "Harry Potter y la piedra filosofal", isRead: true },
{ title: "Canción de hielo y fuego", isRead: false },
{ title: "Devastación", isRead: true },
];
console.log(isBookRead(books, "Devastación")); // true
console.log(isBookRead(books, "Canción de hielo y fuego")); // false
console.log(isBookRead(books, "Los Pilares de la Tierra")); // falseUse TypeScript to add the appropriate types.
-
Install the Node.js dependencies:
cd labs-module-3-language/lab-basic/exercise-4 npm i --save-dev -
Start the development server:
npm run dev
-
End and happy coding!
More info in the following commits. If required.
Grettings @jjpeleato.