Im a javascript beginner and this is my first project in school. Im trying to display an image with the title and so on but i just dont know how to add in the images into my array and display them.
const products = [
{ id: 1, title: "title", description: "description", price: 123},
{ id: 2, title: "title B", description: "description B", price: 456 },
{ id: 3, title: "title C", description: "description C", price: 789 },
];
function displayProducts() {
let container = document.querySelector(".container");
for (let product of products) {
container.innerHTML +=
`<div class="item">` +
`<h2>${product.title}</h2>` +
`<p>${product.description}</p>` +
`<p>Pris: <b>${product.price}</b></p>` +
`<button onclick="addToCart(${product.id})">Buy</button>`;
}
}