1
1
'use strict' ;
2
2
3
+ // eslint-disable-next-line no-unused-vars
3
4
const bookTitles = [
4
5
// Replace with your own book titles
5
6
'my_experiment_with_truth' ,
@@ -12,31 +13,32 @@ const bookTitles = [
12
13
] ;
13
14
14
15
// 1.1 & 1.2 Replace with your own code
15
- //console.log(bookTitles);
16
+ // console.log(bookTitles);
16
17
17
- //1.3 make a function to create ul and li */
18
+ // 1.3 make a function to create ul and li */
18
19
19
20
// Create ul element and assign id
20
21
21
22
const ul = document . createElement ( 'ol' ) ;
22
23
24
+ // eslint-disable-next-line no-unused-vars
23
25
function createBookList ( bookId ) {
24
- for ( let i of bookId ) {
26
+ for ( const i of bookId ) {
25
27
// eslint-disable-next-line no-unused-expressions
26
28
const li = document . createElement ( 'li' ) ;
27
29
li . appendChild ( document . createTextNode ( i ) ) ;
28
30
ul . appendChild ( li ) ;
29
31
}
30
32
}
31
33
32
- //createBookList(bookTitles);
34
+ // createBookList(bookTitles);
33
35
34
36
document . body . appendChild ( ul ) ;
35
37
36
- //1.5
38
+ // 1.5
37
39
38
40
// eslint-disable-next-line vars-on-top
39
- let books = {
41
+ const books = {
40
42
my_experiment_with_truth : {
41
43
title : 'My experiment with truth' ,
42
44
language : 'English' ,
@@ -88,9 +90,9 @@ function createBookListUsingObject(bookObj) {
88
90
let j = 0 ;
89
91
90
92
// eslint-disable-next-line guard-for-in
91
- for ( let i in bookObj ) {
93
+ for ( const i in bookObj ) {
92
94
const li = document . createElement ( 'li' ) ;
93
- //console.log(objectKeys[j]);
95
+ // console.log(objectKeys[j]);
94
96
li . setAttribute ( 'id' , objectKeys [ j ] ) ;
95
97
96
98
const head = document . createElement ( 'h1' ) ;
@@ -122,7 +124,7 @@ createBookListUsingObject(books);
122
124
123
125
// Create a object with Bookid and image
124
126
125
- let bookimage = {
127
+ const bookimage = {
126
128
my_experiment_with_truth : 'gandhi.jpg' ,
127
129
harry_potter : 'harry.jpg' ,
128
130
three_men_in_the_boat : 'threemenintheboat.jpg' ,
@@ -136,10 +138,10 @@ function imageDisplay(imageObject) {
136
138
// eslint-disable-next-line guard-for-in
137
139
let j = 0 ;
138
140
// eslint-disable-next-line guard-for-in
139
- for ( let i in imageObject ) {
140
- //console.log(Object.keys(imageObject)[j]);
141
- let container = document . getElementById ( Object . keys ( imageObject ) [ j ] ) ;
142
- let imageElement = document . createElement ( 'img' ) ;
141
+ for ( const i in imageObject ) {
142
+ // console.log(Object.keys(imageObject)[j]);
143
+ const container = document . getElementById ( Object . keys ( imageObject ) [ j ] ) ;
144
+ const imageElement = document . createElement ( 'img' ) ;
143
145
imageElement . src = imageObject [ i ] ;
144
146
container . appendChild ( imageElement ) ;
145
147
j ++ ;
0 commit comments