forked from HackYourFuture/JavaScript2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.component.js
More file actions
104 lines (98 loc) · 2.16 KB
/
app.component.js
File metadata and controls
104 lines (98 loc) · 2.16 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
'use strict';
//1.git
const bookIds = [
'oliver_twist',
'hamlet',
'antony_and_cleopatra',
'macbeth',
'waiting_for_godot',
'arms_and_the_man',
'the-merchant_of_venice',
'crime_and_punishment',
'romeo_and_juliet',
'a_tale_of_two_cities',
];
//console.log(bookIds);
//3.
function books(bookIds) {
const ul = document.createElement('ul');
document.items.appendChild(ul);
for (let index = 0; index < bookIds.length; index++) {
const li = document.createElement('li');
li.textContent = bookIds[index];
ul.appendChild(li);
}
}
//4.
const DifferentBooks = [
{
title: 'Oliver Twist',
language: 'English',
author: 'Charles-Dickens',
},
{
title: 'Hamlet',
language: 'English',
author: 'Shakespeare',
},
{
title: 'Antony and Cleopatra',
language: 'English',
author: 'Shakespeare',
},
{
title: 'Macbeth',
language: 'English',
author: 'Shakespeare',
},
{
title: 'Waiting for Godot',
language: 'English',
author: 'Samuel Becket',
},
{
title: 'Arms and the Man',
language: 'English',
author: 'George Bernard Show',
},
{
title: 'The Merchant of Venice',
language: 'English',
author: 'Shakespeare',
},
{
title: 'Crime and Punishment',
language: 'Russian',
author: 'Fyodor Dostoevsky',
},
{
title: 'Romeo and Juliet',
language: 'English',
author: 'Shakespeare',
},
{
title: 'A Tale of Two Cities',
language: 'English',
author: 'Charles Dickens',
},
];
//5.
//Can NOT answer it.
//7.
const newBookIds = {
oliver_twist: './img/oliver_twist.jpg',
hamlet: './img/hamlet.jpg',
antony_and_cleopatra: './img/antony_and_cleopatra.jpg',
macbeth: './img/macbeth.jpg',
waiting_for_godot: './img/waiting_for-godot.jpg',
arms_and_the_man: './img/arms_and_the_man.jpg',
the_merchant_of_venice: './img/the_merchant_of_venice.jpg',
crime_and_punishment: './img/crime_and_punishment.jpg',
romeo_and_juliet: './img/romeo_and_juliet.jpg',
a_tale_of_two_cities: './img/a_tale_of_two_cities.jpg',
};
//8.
const entries = DifferentBooks.length;
for (let index = 0; index < entries; index++) {
console.log(entries.author);
}