I created a function that contains a template literal for an image inside the figure element. The problem is when I call that function inside a template literal of the article element, it doesn’t load the image. Here’s the code:
const newImage = (vapeimg) => {
const figure = document.createElement("figure");
figure.classList.add("vape_image");
figure.innerHTML = `
<figure>
<img src=${vapeimg.image} alt="" />
<figcaption> Caliburn Uwell A1 </figcaption>
`;
return figure;
};
/* create a constant function expression for printing vape contents
using arrow function */
const newVape = (currentVape) => {
//creates a new element for article
const newArticle = document.createElement("article");
//add classes and attributes to article element
newArticle.classList.add("vape");
newArticle.setAttribute("id", "pod");
//add HTML contents to the article element
newArticle.innerHTML = `
${newImage(currentVape)}`;
return newArticle;
};



