Loops In Javascript

Table of contents

No heading

No headings in the article.

Loops are an essential part of programming. It helps in many ways to save coding time and makes code looks good.

What is Loop? Loop is the most useful concept in programming, no matter which programming language you are using, you will definitively force to face loops. With the help of loops, we can run the same line of code or a codeblock as many times as we want.

# In Javascript there are two loops : 1) While Loop. ( Used when a loop is based on a condition.) 2) For Loop.( Used when we know how many times code should be run repeatedly)

1) While Loop. Syntax for while loop

while(condition)
{
  // Code goes here L;
}

2) syntax for FOR LOOP.

for( initilization ; condition ; increament)
{
// code goes here ;
}