loops in javascript list code example
Example 1: javascript iterate through for loop
var myStringArray = ["Hello","World"];
var arrayLength = myStringArray.length;
for (var i = 0; i < arrayLength; i++) {
console.log(myStringArray[i]);
//Do something
}
Example 2: javascript loop
var colors=["red","blue","green"];
for(let color of colors){
console.log(color)
}