-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathmain.js
More file actions
36 lines (28 loc) · 784 Bytes
/
main.js
File metadata and controls
36 lines (28 loc) · 784 Bytes
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
"use strict";
const goods = [
{ title: 'Shirt', price: 150 },
{ title: 'Socks', price: 50 },
{ title: 'Jacket', price: 350 },
{ title: 'Shoes', price: 250 },
{ },
{ },
{ },
{ },
{ },
{ },
{ },
{ },
{ }
];
const renderGoodsItem = (title = 'Товар закончился', price = '0') =>
`<div class='goodsItem'>
<img src='image/defGoods.png' alt='good'>
<h3>${title}</h3>
<p>${price}$</p>
<button class="cartButtonAdd" type="button">Добавить</button>
</div>`;
const renderGoodsList = list => {
let goodsList = list.map(item => renderGoodsItem(item.title, item.price));
document.querySelector('.goodsList').innerHTML = goodsList.join('');
};
renderGoodsList(goods);