While-3

 

Example of JavaScript While Statement:

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <p id="sample"></p> <script> var i = 0; var j = 10; while (i < 100) { if (i == j) break; i++; } document.getElementById("sample").innerHTML = i; </script> </body> </html>
Output