Try it
Javascript
Jquery
Angular
Learn Angular
Learn Javascript
Learn Bootstrap
Learn jQuery
While-4
Example of JavaScript
while
statement:
<!DOCTYPE html> <html> <head> </head> <body> <button onclick="myFunction()">Click it</button> <p id="sample"></p> <script> function myFunction() { var sum = 0; var number = 1; while (number <= 50) { sum += number; number++; } alert("Sum = " + sum); } document.getElementById("sample").innerHTML = i; </script> </body> </html>
Output
×
Save This try
Title
Description
<p>Example of JavaScript <code>while</code> statement:</p>