JSFiddle - React, Tailwind, and code Playground
JavaScript
const table = new Array(10).fill({foo: 0});
for (let i = 0; i < table.length; i += 1) {
table[i].bar = i;
}
// show results
ul = document.createElement('ul');
table.forEach((el) => {
const li = document.createElement('li');
li.innerHTML = `foo: ${el.foo}, bar:${el.bar}`;
ul.appendChild(li);
})
document.body.appendChild(ul);