<template id="tmpl">
<div class="card">
<h3 class="header"></h3>
<p class="text1"></p>
<p class="text2"></p>
</div>
</template>
const tmpl = document.getElementById('tmpl');
const makeCard = ({ header, text1, text2 }) => {
const card = tmpl.content.cloneNode(true);
card.querySelector('h3').innerText = header;
card.querySelector('p.text1').innerText = text1;
card.querySelector('p.text2').innerText = text2;
return card;
}
const cards = [
{ header: "header1", text1: "text 1.1", text2: "text 2.1" },
{ header: "header2", text1: "text 1.2", text2: "text 2.2" },
];
const fragment = new DocumentFragment();
cards.forEach(cardData => fragment.append(makeCard(cardData)));
document.body.appendChild(fragment);
This Pen doesn't use any external JavaScript resources.