To For-each over an array in JavaScript, we use a for-of loop.
For instance, we write
const a = ["a", "b", "c"];
for (const element of a) {
console.log(element);
}
to loop through the a
array with the for-of loop.
We get the element being looped through from element
.