Console.Log in For Loop Test

Iterates over a loop 4000 times and prints to the console, only if the index is divisible by 20.

by cybermention

JavaScript

/* Instructions for IE 11, 
		Right click and Inspect element on this page.
    Then, go to the Console tab.
    Then, click the "Run" button above, on this jsFiddle page.
*/



// clear the console (allows for easier read on multiple runs)
console.clear();									//#note#

// loop 4000 times
for (var i = 0, j = 4000; i < j; i++) {
  // display iteration, only if the index is divisible by 20
  if (i % 20 == 0) {							//#note#
    console.log(i);
  }																//#note#
}



/* Note : 
	 - To see the console error, 
     - comment out the lines with the "//#note#" comments above, and 
     - click the "Run" button again.
*/