for loop string array in javascript code example
Example 1: iterate through list javascript
const array = ["hello", "world"];
for (item of array) {
//DO THIS
}
Example 2: iterate over array javascript
var txt = "";
var numbers = [45, 4, 9, 16, 25];
numbers.forEach(myFunction);
function myFunction(value, index, array) {
txt = txt + value + "<br>";
}