डिप्लोमा इन ऑफिस मैनेजमेंट एण्ड अकाउटिंग

डिप्लोमा इन ऑफिस मैनेजमेंट एण्ड अकाउटिंग

Full Stack Web Development with Laravel

Full Stack Web Development with Laravel

Affiliate Program

Affiliate Program

Loop in Java Script

Repeatation of any statement is called a loop.
 
There are three types of loop.
  1. For loop
  2. while loop
  3. do while loop
 

for loop

It is called a fixed loop, where initialisation, condition and increment/decrement write together.
 
syntax:
for(start; end; step){
statements to be repeat
}
statement to not repeat
 

while loop

it is called entry control loop, where we check condition first then execute.
 
syntax
 
start;
while(end){
statements to be repeat
step;
}

do while loop

it is called exit control loop, where we check the condition at last.
do while loop run atleast one time either condition true or false.
 
syntax:
start;
do{
statement to be repeat
step;
}
while(end);
 

Nested loop

Loop inside a loop is called nested loop, any loop can be write as nested loop.
 
syntax
for(start; end; step){
inside part of outer loop
for(start; end; step){
// inside part of inner loop
}
}
© 2016 - 2023, All Rights are Reserved.