Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 2117adf

Browse filesBrowse files
committed
implementation of feedback to JS2 Week1 homework from Ann-Grabetski
1 parent 60d625f commit 2117adf
Copy full SHA for 2117adf

File tree

Expand file treeCollapse file tree

1 file changed

+52
-29
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+52
-29
lines changed
Open diff view settings
Collapse file

‎Week1/homework/app.js‎

Copy file name to clipboard
+52-29Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
{
4-
54
const booksArray = [
65
`The_Goldfinch`,
76
`A_Garden_of_Earthly_Delights`,
@@ -12,80 +11,70 @@
1211
`The_Unwomanly_Face_of_War`,
1312
`Chernobyl_Prayer`,
1413
`Runaway`,
15-
`The_Year_of_Magical_Thinking`
14+
`The_Year_of_Magical_Thinking`,
1615
];
1716

1817
const booksObject = {
1918
The_Goldfinch: {
2019
title: `The Goldfinch`,
2120
author: `Donna Tartt`,
22-
original_language: `English`
21+
original_language: `English`,
2322
},
2423
A_Garden_of_Earthly_Delights: {
2524
title: `A Garden of Earthly Delights`,
2625
author: `Carol Oates`,
27-
original_language: `English`
26+
original_language: `English`,
2827
},
2928
Beloved: {
3029
title: `Beloved`,
3130
author: `Toni Morrison`,
32-
original_language: `English`
31+
original_language: `English`,
3332
},
3433
There_Once_Lived_a_Woman_Who_Tried_to_Kill_Her_Neighbors_Baby: {
3534
title: `There Once Lived a Woman Who Tried to Kill Her Neighbo\'s Baby`,
3635
author: `Lyudmila Petrushevskaya`,
37-
original_language: `Russian`
36+
original_language: `Russian`,
3837
},
3938
The_House_of_the_Spirits: {
4039
title: `The House of the Spirits`,
4140
author: `Isabel Allende`,
42-
original_language: `Spanish`
41+
original_language: `Spanish`,
4342
},
4443
The_Left_Hand_of_Darkness: {
4544
title: `The Left Hand of Darkness`,
4645
author: `Ursula K. Le Guin`,
47-
original_language: `English`
46+
original_language: `English`,
4847
},
4948
The_Unwomanly_Face_of_War: {
5049
title: `The Unwomanly Face of War`,
5150
author: `Svetlana Alexievich`,
52-
original_language: `Russian`
51+
original_language: `Russian`,
5352
},
5453
Chernobyl_Prayer: {
5554
title: `Chernobyl Prayer`,
5655
author: `Svetlana Alexievich`,
57-
original_language: `Russian`
56+
original_language: `Russian`,
5857
},
5958
Runaway: {
6059
title: `Runaway`,
6160
author: `Alice Munro`,
62-
original_language: `English`
61+
original_language: `English`,
6362
},
6463
The_Year_of_Magical_Thinking: {
6564
title: `The Year of Magical Thinking`,
6665
author: `Joan Didion`,
67-
original_language: `English`
68-
}
66+
original_language: `English`,
67+
},
6968
};
7069

71-
for (const book of booksArray) {
72-
const title = booksObject[book].title;
73-
const author = booksObject[book].author;
74-
const original_language = booksObject[book].original_language;
75-
76-
console.log(title);
77-
console.log(author);
78-
console.log(original_language);
79-
};
80-
8170
const booksList = document.createElement(`ul`);
8271
document.body.insertBefore(booksList, document.body.childNodes[2]);
8372

8473
for (const book of booksArray) {
8574
const listItem = document.createElement(`li`);
8675
booksList.appendChild(listItem);
8776
listItem.setAttribute(`id`, book);
88-
77+
8978
const title = document.createElement(`h3`);
9079
listItem.appendChild(title);
9180
const titleContent = document.createTextNode(booksObject[book].title);
@@ -99,8 +88,43 @@
9988

10089
const original_language = document.createElement(`p`);
10190
listItem.appendChild(original_language);
102-
const original_languageContent = document.createTextNode(`Original language: ${booksObject[book].original_language}`);
91+
const original_languageContent = document.createTextNode(
92+
`Original language: ${booksObject[book].original_language}`,
93+
);
10394
original_language.appendChild(original_languageContent);
95+
}
96+
97+
const imagesObject = {
98+
The_Goldfinch: {
99+
url: `images/The_Goldfinch.jpg`,
100+
},
101+
A_Garden_of_Earthly_Delights: {
102+
url: `images/A_Garden_of_Earthly_Delights.jpg`,
103+
},
104+
Beloved: {
105+
url: `images/Beloved.jpg`,
106+
},
107+
There_Once_Lived_a_Woman_Who_Tried_to_Kill_Her_Neighbors_Baby: {
108+
url: `images/There_Once_Lived_a_Woman_Who_Tried_to_Kill_Her_Neighbors_Baby.jpg`,
109+
},
110+
The_House_of_the_Spirits: {
111+
url: `images/The_House_of_the_Spirits.jpg`,
112+
},
113+
The_Left_Hand_of_Darkness: {
114+
url: `images/The_Left_Hand_of_Darkness.jpg`,
115+
},
116+
The_Unwomanly_Face_of_War: {
117+
url: `images/The_Unwomanly_Face_of_War.jpg`,
118+
},
119+
Chernobyl_Prayer: {
120+
url: `images/Chernobyl_Prayer.jpg`,
121+
},
122+
Runaway: {
123+
url: `images/Runaway.jpg`,
124+
},
125+
The_Year_of_Magical_Thinking: {
126+
url: `images/The_Year_of_Magical_Thinking.jpg`,
127+
},
104128
};
105129

106130
for (const book of booksArray) {
@@ -109,7 +133,6 @@
109133
const image = document.createElement(`img`);
110134
listItem.appendChild(image);
111135
listItem.insertBefore(image, listItem.childNodes[0]);
112-
image.setAttribute(`src`, `images/${book}.jpg`);
113-
};
114-
115-
};
136+
image.setAttribute(`src`, imagesObject[book].url);
137+
}
138+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.