programming-examples/js/Object/Gather and display infromation from an object .js
2019-11-15 12:59:38 +01:00

27 lines
843 B
JavaScript

var library = [
{
title: 'Bill Gates',
author: 'The Road Ahead',
readingStatus: true
},
{
title: 'Steve Jobs',
author: 'Walter Isaacson',
readingStatus: true
},
{
title: 'Mockingjay: The Final Book of The Hunger Games',
author: 'Suzanne Collins',
readingStatus: false
}];
for (var i = 0; i < library.length; i++)
{
var book = "'" + library[i].title + "'" + ' by ' + library[i].author + ".";
if (library[i].readingStatus) {
console.log("Already read " + book);
} else
{
console.log("You still need to read " + book);
}
}