how to store a foreach loop in array in javascript code example
Example 1: js loop array
let colors = ['red', 'green', 'blue'];
for (const color of colors){
console.log(color);
}
Example 2: what is the modern syntax for iterating through array using for loop in javascript
let friends=["jony","tom","Tejas"];
friends.forEach(
function f(i){
console.log(i);
}
)