Javascript examples for Statement:while
Increase and decrease a variable until a number is reached using for and while loop
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {/* ww w . ja va 2 s.c o m*/ for (var i=0;i<100;i++) { document.write("The number is " + i); document.write("<br />"); } while (i>0) { i -= 10; document.write("The number is " + i); document.write("<br />"); } }); </script> </head> <body> </body> </html>