Javascript For Loop Code Syntax Example
Loops are the most common and complicated part of any programming language. First of all what is loop or iteration? Loop is used for executing a set of statements or instructions repeatedly. To perform the repetitive task, Javascript provides us 3 types of Loop. For Loop is one of them. In this free javascript tutorial i am going to discuss on only For Loop. If we need to run multiple statement within a loop then the statements must be enclosed by curly braces { }. But for a single statement no need to wrap the line within curly braces because, for any iteration/loop if the condition satisfy then by default first line of code will be executed. This statement is also true for other programming languages. Keep in mind two things when you want to write a loop statement: 1. Statements that you need to iterate 2. Termination or exit from loop