javasdcript for loop code example

Example 1: javascript for loop

for (var i; i < 10; i++) {
  
}

Example 2: javascript loop if statement

// a loop is where you say i = 5 and if i < 6 {
 // print("hdyugvryvg");
// it means i = 5 and 6 is greater than 5 so it should print out hdyugvryvg 5 times
//}

// example

for (let i = 0; i < 10000; i++) {
 	console.log('huduiduin 100000 times'); 
}



// dont try this put a lower number this nearly crashed my browser

Example 3: for of loop syntax javascript

for (let step = 0; step < 5; step++) {
  // Runs 5 times, with values of step 0 through 4.
  console.log('Walking east one step');
}

Example 4: loop javascript

//this is javascript
var speed = 100;
setInterval(function() {
//DO SOMETHING THAT REPEATS
},speed);

Tags:

Cpp Example