You are on page 1of 3

Javascript loops

Loops are programming constructs that facilitate the execution


of a set of instructions of code repeatedly, as long as a certain
condition is met.  

Loops

Entry Level Exit Level


Entry controlled loop is a loop in which the test Exit controlled loop is a loop in which the loop
condition is checked first, and then loop body will body is executed first and then the given
be executed. condition is checked afterwards.
In entry controlled loop, if the test condition is In exit controlled loop, if the test condition is false,
false, loop body will not be executed. loop body will be executed at least once.

for while do..while


for Loops

 for loops generally used where we know no of times loops will iterate the
loop body
 for loops is also preferred when we have to iterate through array element in
JavaScript

Syntax

for (begin; condition; step)


{ // ... loop body ... }

You might also like