javascript through array code example
Example 1: javascript through array
var colors = ["red","blue","green"];
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
Example 2: javascript iterate array
var txt = "";
var numbers = [45, 4, 9, 16, 25];
numbers.forEach(function(value, index, array) {
txt = txt + value + "<br>";
});