How to use while loop in JavaScript?
While Loop in JavaScript
230
19-Jul-2021
Updated on 19-Jul-2021
Ethan Karla
20-Jul-2021We use of loops in a program for execute the block of code to particular time.
While loop is one of the type of the loop in which we perform any operation to nth number of time.
For loops are great for doing the same task over and over when you know ahead of time how many times you'll have to repeat the loop.
On the other hand, while loops are ideal when you have to loop, but you don't know ahead of time how many times you'll need to loop.