loop value in array js code example
Example 1: iterate through list javascript
const array = ["hello", "world"];
for (item of array) {
//DO THIS
}
Example 2: how to iterate in array of array
var printArray = function(arr) {
if ( typeof(arr) == "object") {
for (var i = 0; i < arr.length; i++) {
printArray(arr[i]);
}
}
else document.write(arr);
}
printArray(parentArray);