Contact Us || Privacy Policy || About Us |
|
JS LoopLoops can be execute a block of code a number of times. Types of LoopThere are 4 types of loops in JavaScript that is.
1) For loop in JavaScriptIn for loop is used to repeat the execution of the statements until a certain condition holds. Syntax: Flow Chart :- ![]() Example:- Test it Now2) while loop in JavaScriptIn while loop check the condition is true,the code inside the while loop is executed.when the condition is false the loop will be stops Syntax: Example:- Print Fibonacci series Test it Now3) do-while loop JavaScriptIn do while loop body of the loop is executed(Check) at first. Then the condition is evaluated. If the condition evaluates is true, the body of the loop inside the do statement is executed again.this process continues until the condition evaluates is to be false. Then the loop stops. Syntax: Example:- Print Even numbers Test it Now |