To loop through a set of elements in JavaScript, we use a for-of loop.
For instance, we write
const list = [
{ a: 1, b: 2 },
{ a: 3, b: 5 },
{ a: 8, b: 2 },
{ a: 4, b: 1 },
{ a: 0, b: 8 },
];
for (const item of list) {
console.log(item);
}
to loop through the list
array with a for-of loop.
Then we get the item
being looped through and log it.