Day 3: Display Information from an Object
Submissions will no longer be placed on the leaderboard. You may still attempt this problem for practice.
Displaying Information contained in Objects
Stack Overflow has a nice, well summarized tutorial related to displaying information contained in objects.
Task
Write a JavaScript program to display the status (i.e. display book name, author name and reading status) of books. You are given an object library in the code's template. It contains a list of books with the above mentioned properties. Your task is to display the following:
If the book is unread:
You still need to read '<book_name>' by <author_name>.
If the book is read:
Already read '<book_name>' by <author_name>.
xxxxxxxxxx
24
1
function displayInformation() {
2
// var library is defined, use it to print the information
3
}
4
5
// tail starts here
6
var library = [
7
{
8
title: 'Bill Gates',
9
author: 'The Road Ahead',
10
readingStatus: true
11
},
12
{
13
title: 'Steve Jobs',
14
author: 'Walter Isaacson',
15
readingStatus: true
16
},
17
{
18
title: 'Mockingjay: The Final Book of The Hunger Games',
19
author: 'Suzanne Collins',
20
readingStatus: false
21
}
22
];
23
24
displayInformation();