To loop through an array in JavaScript, we use a for-of loop.
For instance, we write
const colors = ["red", "green", "blue"];
for (const color of colors) {
console.log(color);
}
to loop through the colors
array with a for-of loop.
And we get the value being looped through with color
.