for loop in nodejs code example

Example 1: javascript for loop

var colors=["red","blue","green"];
for (let i = 0; i < colors.length; i++) { 
  console.log(colors[i]);
}

Example 2: for loop in node js

var i;
for (i = 0; i < cars.length; i++) {
  text += cars[i] + "<br>";
}

Example 3: loop an array in javascript

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
}

Example 4: for loop javascript

var i;
for (i = 0; i < 10 ; i++) {
  //do something
}