syntax for loop in javascript code example
Example 1: js for loop
var i; //defines i
for (i = 0; i < 5; i++) { //starts loop
console.log("The Number Is: " + i); //What ever you want
}; //ends loop
//Or:
console.log("The Number Is: " + 0);
console.log("The Number Is: " + 1);
console.log("The Number Is: " + 2);
console.log("The Number Is: " + 3);
console.log("The Number Is: " + 4);
//They do the same thing!
//Hope I helped!
Example 2: how to make a javascript for loop
var tops = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144];
for (let i = 0; i < tops.length; i++) {
document.write(tops[i] + "tops");
}