In Association with Amazon.in   Flipkart

Saturday, August 10, 2013

JavaScript Looping Statements

In JavaScript there are 4 types of  Looping Statements:

  1. For Loop
  2. While Loop
  3. Do While
  4. For In (For displaying  Array elements)
1. For Loop:

Syntax: 
              for(Initialization;  Test Condition; Increment/Decrement)
               {
                 -----------------;
                ------------------;
              }


2. While Loop:

Syntax:
              Initialization;
              while(Test Condition)
             {
                ----------------;
                ----------------;
               Increment/Decrement statement;
           }

3. Do While Loop:

Syntax: 
               Initialization;
              do
              {
                ----------------;
                ----------------;
               Increment/Decrement statement;
             }while(Test Condition);


4. For In Loop: 
For displaying  Array elements)

Syntax: 

          for(var_name in Array_name)

         {
             --------------------;
            ---------------;
        }

No comments:

Post a Comment


Related Posts Plugin for WordPress, Blogger...