iterate through array javascript

JavaScript
var myStringArray = ["hey","World"];
var arrayLength = myStringArray.length;
for (var i = 0; i < arrayLength; i++) {
    console.log(myStringArray[i]);
    //Do something
}const array = ["one", "two", "three"]
array.forEach(function (item, index) {
  console.log(item, index);
});var len = arr.length;
while (len--) {
    // blah blah
}array = [ 1, 2, 3, 4, 5, 6 ]; 
for (index = 0; index < array.length; index++) { 
    console.log(array[index]); 
} var myStringArray = ["Hello","World"];
var arrayLength = myStringArray.length;
for (var i = 0; i < arrayLength; i++) {
    console.log(myStringArray[i]);
    //Do something
}var colors = ["red","blue","green"];
colors.forEach(function(color) {
  console.log(color);
});
Source

Also in JavaScript: