The while loops through a block of code when condition is true.
Syntax
while (condition) {
// Code to be executed;
}
Example
var i;
while(i<=5){
document.write(i+"<br>");
}
Output
1
2
3
4
5
Copyright ©2022 coderraj.com. All Rights Reserved.