JavaScript
- 3 ответа
- 0 вопросов
0
Вклад в тег
const options = {
header: "Изучение языков",
items: {
item1: {img: "img/languages/pascal.png", name: "Pascal", perClick: 0, cost: "Куплено"},
item2: {img: "img/languages/visual-basic.png", name: "Visual Basic", perClick: 2, cost: 900},
item3: {img: "img/languages/html.png", name: "HTML", perClick: 5, cost: 5100},
item4: {img: "img/languages/css.png", name: "CSS", perClick: 12, cost: 31000},
item5: {img: "img/languages/php.png", name: "PHP", perClick: 25, cost: 90000},
item6: {img: "img/languages/javascript.png", name: "Javascript", perClick: 100, cost: 380000},
item7: {img: "img/languages/c++.png", name: "C++", perClick: 224, cost: 970000},
item8: {img: "img/languages/delphi.png", name: "Delphi", perClick: 700, cost: 5000000},
item9: {img: "img/languages/python.png", name: "Python", perClick: 1680, cost: 12000000},
item10: {img: "img/languages/java.png", name: "Java", perClick: 3640, cost: 59000000}
}
};
const app = document.createElement("div");
function createLi(options){
let context = '';
for (const value of Object.values(options.items))
{
context += `<li>${value.name}</li>`;
}
return context;
}
app.innerHTML = createLi(options);
"${options.items.item1.img}"
должен быть шаблонный литерал `${options.items.item1.img}`
обрати внимание на кавычки обратные.