Learn JavaScript

JavaScript Loops

Loops are very useful in any programming language. Whenever you want to execute a particular set of code snippets multiple times, with different set of input values, in that case you can take the help of loops. Loop statements are frequently use to execute array.

Standard Syntax of a JavaScript Loop

loop (Loop Initialization; Loop Test Condition; Loop Iteration Statement)
Statement 1;
Statement 2;
Statement 3;
Statement n;
// set of statements execute, if the test condition is true


Loop Initialization: In loop initialization, the initial value or starting value is assign to the counter variable. The execution of a loop begins from The loop initialization statement.

Loop Test Condition: After initialization of the counter variable, the next statement that is executed under JavaScript loop is loop test condition. The loop test condition is checked and, if the truth value of the test condition is found to be true then control passes inside the loop and the set of statements within the loop will be executed. If the truth value of the loop test condition is false, then the control exit from the loop for next iteration.

Loop Iteration Statement: Loop iteration statement is a statement, where you can increase or decrease the value of the counter value.

Types of Loops in JavaScript

  • for
  • for in
  • for of
  • while
  • do while

Note: In further tutorials, we will be discussing about each and every loop listed above in greater detail.


This JavaScript tutorial is designed to help the beginners as well as the professional developers. For better understanding the language of the tutorial is kept simple and easy to understand.


This tutorial demands to have the basic knowledge of the programming languages such as c or c++, HTML for the better understanding of the JavaScript programming language. The other basic requirement to learn JavaScript through this tutorial is the basic knowledge of computer and information technology so you can easily acquire a better understanding JavaScript programming.

Community Helping

In case you find any kind of error like typing error, spelling mistakes, incorrect grammar, incorrect information or any other mistakes. Please feel free to write to us at: akyadav@etutororg.com.