javascript loop over numbers code example
Example 1: js for loops
let i;
for (i = 0; i < 6; ++i) {
console.log("Hello"); // print Hello 6 times
}
Example 2: Iterate with JavaScript For Loops
var myArray = [];
for (var i = 1; i <= 5; i++){
myArray.push(i);
}
console.log(myArray) // console output [ 1, 2, 3, 4, 5 ]