loop an array in javascript

JavaScript
var colors = ["red","blue","green"];
for (var i = 0; i < colors.length; i++) {
    console.log(colors[i]);
}const myArray = ['foo', 'bar'];

myArray.forEach(x => console.log(x));

//or

for(let i = 0; i < myArray.length; i++) {
  console.log(myArray[i]);
}
var myStringArray = ["Hello","World"];
var arrayLength = myStringArray.length;
for (var i = 0; i < arrayLength; i++) {
    console.log(myStringArray[i]);
    //Do something
}let array = ["loop", "this", "array"]; // input array variable
for (let i = 0; i < array.length; i++) { // iteration over input
	console.log(array[i]); // logs the elements from the current input
}array = [ 1, 2, 3, 4, 5, 6 ]; 
   //set variable//set the stop count // increment each loop
for (let i = 0; i < array.length ;i++) { 
  
         array[i] //iterate through each index.
   //add the intructions you would like to perform.
    
             // add any method to array[
} 
Source

Also in JavaScript: