loop through array javascript to find specific value code example
Example 1: javascript loop through array
var myStringArray = ["hey","World"];
var arrayLength = myStringArray.length;
for (var i = 0; i < arrayLength; i++) {
console.log(myStringArray[i]);
//Do something
}
Example 2: javascript loop through array
let array = ['Item 1', 'Item 2', 'Item 3'];
for (let item of array) {
console.log(item);
}