JavaScript Tutorial

Javascript Loop While

The while loop is a control flow statement in JavaScript that allows you to repeatedly execute a block of code as long as a specified condition is true. Here is the syntax for the while loop:

Let’s see the simple example of while loop in javascript.

Input:-

Output:-

Do while() loop

The while loop is a control flow statement in JavaScript that allows you to repeatedly execute a block of code as long as a specified condition is true. Here is the syntax for the while loop:

Let’s see the simple example of do while loop in javascript.

Input:-

Output:-


Go back to Previous Course