Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd214b0

Browse files
committed
fixed warning and errors
1 parent 3a5fdb4 commit fd214b0

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

Week1/homework/app.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
// eslint-disable-next-line no-unused-vars
34
const bookTitles = [
45
// Replace with your own book titles
56
'my_experiment_with_truth',
@@ -12,31 +13,32 @@ const bookTitles = [
1213
];
1314

1415
// 1.1 & 1.2 Replace with your own code
15-
//console.log(bookTitles);
16+
// console.log(bookTitles);
1617

17-
//1.3 make a function to create ul and li */
18+
// 1.3 make a function to create ul and li */
1819

1920
// Create ul element and assign id
2021

2122
const ul = document.createElement('ol');
2223

24+
// eslint-disable-next-line no-unused-vars
2325
function createBookList(bookId) {
24-
for (let i of bookId) {
26+
for (const i of bookId) {
2527
// eslint-disable-next-line no-unused-expressions
2628
const li = document.createElement('li');
2729
li.appendChild(document.createTextNode(i));
2830
ul.appendChild(li);
2931
}
3032
}
3133

32-
//createBookList(bookTitles);
34+
// createBookList(bookTitles);
3335

3436
document.body.appendChild(ul);
3537

36-
//1.5
38+
// 1.5
3739

3840
// eslint-disable-next-line vars-on-top
39-
let books = {
41+
const books = {
4042
my_experiment_with_truth: {
4143
title: 'My experiment with truth',
4244
language: 'English',
@@ -88,9 +90,9 @@ function createBookListUsingObject(bookObj) {
8890
let j = 0;
8991

9092
// eslint-disable-next-line guard-for-in
91-
for (let i in bookObj) {
93+
for (const i in bookObj) {
9294
const li = document.createElement('li');
93-
//console.log(objectKeys[j]);
95+
// console.log(objectKeys[j]);
9496
li.setAttribute('id', objectKeys[j]);
9597

9698
const head = document.createElement('h1');
@@ -122,7 +124,7 @@ createBookListUsingObject(books);
122124

123125
// Create a object with Bookid and image
124126

125-
let bookimage = {
127+
const bookimage = {
126128
my_experiment_with_truth: 'gandhi.jpg',
127129
harry_potter: 'harry.jpg',
128130
three_men_in_the_boat: 'threemenintheboat.jpg',
@@ -136,10 +138,10 @@ function imageDisplay(imageObject) {
136138
// eslint-disable-next-line guard-for-in
137139
let j = 0;
138140
// 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');
143145
imageElement.src = imageObject[i];
144146
container.appendChild(imageElement);
145147
j++;

0 commit comments

Comments
 (0)