nested while loop in JavaScript

 nested while loop in JavaScript

In this article we are goanna to see about nested while loop and where we use these. which is most important when you are going to start your career in JavaScript. Please read and enjoy this article if you want to give any feedback about your experience, we welcome.




While loop inside while loop that is called nested while loop in Javascript.

Syntax:

while(condition){
block of loop statements;
increment/decrement;
while(condition){
block of loop statements;
increment/decrement;
}
}

Ex:

var i= 0;
while(i<3){
document.write(i + “<br>”);
i++;
var x=0;
while(x<4){
document.write(x +”<br>”);
x++;
}
}


Share:

0 comments

Please leave your comments...... Thanks