I’ve been trying to figure this one out – if someone has some pointers I would appriciate it. Basically I got an object which has 3 properties, I need to check if one of those properties is true or false, and return based true/false.
So far, made this code but as I understand it doesn’t recognize object.properties..
const library = [
{
title: "Bill Gates",
author: "The Road Ahead",
isRead: true
},
{
title: "Steve Jobs",
author: "Walter Isaacson",
isRead: true
},
{
title: "Mockingjay: The Final Book of The Hunger Games",
author: "Suzanne Collins",
isRead: false
}
];
const showStatus = (arg) => {
let book = arg;
for(let i = 0;i < book.length; i++){
if(book.isRead === true){
console.log(`Already read ${book.title} by ${book.author}.`)
} else {
console.log(`You still need to read ${book.title} by ${book.author}`)
}
}
};
showStatus(library);