I'm trying to make a memory game. I need to insert the cards into the HTML file with JavaScript. I've succeeded to do this with one card:
fruits = [`mangosteen image link`, `rambutan img link`, `pineapple img link`];
let insertCard = document.getElementById('containerId');
let cardBase = `/*bunch of other elements that have to repeat*/
<div class="card-front card-face">
<img class="card-value card-img"
src="${fruits[2]}">
</div>`;
insertCard.insertAdjacentHTML('beforeend', cardBase);
EDITED: How do I insert different values from the array into src="${array piece here}"> without just copying the code (a string(that is a link) once for the card)? And then the cards also have to be double (memory card matching game) And then move on to the next value (the img link) in the array?
Sorry if this is a stupid question, I'm very new to this all. Not using the correct terms and bad at explaining my problem too I guess. Is using template literals the wrong choice? I'm I doing the other way around? I've been trying to fix this for days now.