我创建了一个对象数组:
let games = [{
title: 'God of War',
price: 50,
img: "./assets/images/God-of-War.jpg"
},
{
title: 'Death Stranding',
price: 70,
img: "./assets/images/Death-Stranding.jpg"
},
{
title: 'The Last Of Us 2',
price: 40,
img: "./assets/images/The-Last-Of-Us-2.jpg"
}
];
<h1>Games</h1>
<div>
<div>
<h2>
<script>
games[0].title
</script>
</h2>
<button>Buy</button>
</div>
</div>
我想像在电子商务网站中一样显示所有这些值,但我无法在我的 HTML 中显示这些值。这是我的 HTML 代码:
撒科打诨
桃花长相依
相关分类