iterate through array js

JavaScript
array = [ 1, 2, 3, 4, 5, 6 ]; 
for (index = 0; index < array.length; index++) { 
    console.log(array[index]); 
} let arbitraryArr = [1, 2, 3];
// below I choose let, but var and const can also be used 
for (let arbitraryElementName of arbitraryArr) {
  console.log(arbitraryElementName);
}var txt = "";
var numbers = [45, 4, 9, 16, 25];

numbers.forEach(function(value, index, array) {
  txt = txt + value + "<br>";
});
String[] myStringArray = {"Hello", "World"};
for (String s : myStringArray)
{
    // Do something
}
Source

Also in JavaScript: