-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
68 lines (60 loc) · 2.35 KB
/
index.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
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
const bookStore = {
name: 'Flatbooks Technical Books',
books: [
{
id:1,
title: 'Eloquent JavaScript: A Modern Introduction to Programming',
author: 'Marjin Haverbeke',
imageUrl: 'https://images-na.ssl-images-amazon.com/images/I/51IKycqTPUL._SX218_BO1,204,203,200_QL40_FMwebp_.jpg',
},
{
id:2,
title: 'JavaScript & JQuery: Interactive Front-End Web Development',
author: 'Jon Duckett',
imageUrl: 'https://images-na.ssl-images-amazon.com/images/I/31SRWF+LkKL._SX398_BO1,204,203,200_.jpg'
},
{
id:3,
title: 'JavaScript: The Good Parts',
author: 'Douglas Crockford',
imageUrl: 'https://images-na.ssl-images-amazon.com/images/I/5131OWtQRaL._SX218_BO1,204,203,200_QL40_FMwebp_.jpg',
},
{
id:4,
title: 'JavaScript: The Definitive Guide',
author: 'David Flanagan',
imageUrl: "https://images-na.ssl-images-amazon.com/images/I/51wijnc-Y8L._SX379_BO1,204,203,200_.jpg"
},
{
id:5,
title: 'You Don’t Know JS',
author: 'Kyle Simpson',
imageUrl: 'https://images-na.ssl-images-amazon.com/images/I/41T5H8u7fUL._SX331_BO1,204,203,200_.jpg'
},
{
id:6,
title: 'Cracking the Coding Interview',
author: 'Gayle Laakmann McDowell',
imageUrl: 'https://images-na.ssl-images-amazon.com/images/I/41oYsXjLvZL._SY344_BO1,204,203,200_.jpg'
}
]
}
// Write your code here!
const bookStoreTitle = document.querySelector('#header')
document.querySelector('#delete-this').remove()
bookStoreTitle.textContent = bookStore.name
function addToBookList(book){
const bookContainer = document.createElement('li')
const bookTitle = document.createElement('h3')
const bookAuthor = document.createElement('p')
const bookImage = document.createElement('img')
bookTitle.textContent = book.title
bookAuthor.textContent = book.author
bookImage.src = book.imageUrl
const bookList = document.querySelector('#book-list')
bookContainer.append(bookTitle,bookAuthor,bookImage)
bookList.append(bookContainer)
}
bookStore.books.forEach(book => {
addToBookList(book)
})