-
Notifications
You must be signed in to change notification settings - Fork 0
/
book_arthur.js
31 lines (24 loc) · 862 Bytes
/
book_arthur.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var libarary = [BookOne, BookTwo]
var BookOne = {
title: "Javascript for Beginners",
body: ['You have to know how to use console', 'Better be good at using Google', 'Table tennis is also a good skill'],
}
var BookTwo = {
title: "Javascript for Nerds",
body: ['It\'s not that hard', 'You don\'t have to be a nerd', 'Now you\'re a legend'],
}
function readBook(BookNumber) {
console.log('Title: ' + BookNumber.title)
for (i = 0; i < BookNumber.body.length; i++ ) {
console.log('Page ' + (i + 1) + ': ' + BookNumber.body[i])
}
}
readBook(BookTwo)
readBook(BookOne)
// function readBook(BookNumber) {
// console.log('Title: ' + BookNumber.title)
// for (var key in BookNumber.body) {
// var PageNumber = eval(key) + 1
// console.log('Page ' + PageNumber + ': ' + BookNumber.body[key])
// }
// }