let obj = [{ name: "", average: "", cpu: "", price: "",},{ name: "", average: "", cpu: "", price: "",},{ name: "", average: "", cpu: "", price: "",},{ name: "", average: "", cpu: "", price: "",}]
<div data-name="" data-average="" data-cpu="" data-price=""></div>
for(const inf of obj){ let d = document.createElement("div"); d.setAttribute("data-name", inf.name); d.setAttribute("data-average", inf.average); d.setAttribute("data-cpu", inf.cpu); d.setAttribute("data-price", inf.price); console.log(d) }