The for loop

Estimated reading: 1 minute 68 views

Afor loop is made up of four statements and has the following structure:

				
					 for ([initialisation]; [conditional]; [iteration])
 [loopBody]
				
			
				
					// logs ’try 0’, ’try 1’, ..., ’try 4’
 for (var i=0; i<5; i++) {
 console.log(’try ’ + i);
 }
				
			
Share this Doc

The for loop

Or copy link