While Loops

This page will display a line item for each iteration of less than or equal to 10.

Code Example

<script>
 let text = "";
 let i = 0;
 while (i < 10) {
   text += "<br>The number is " + i;
   i++;
 }
 document.getElementById("demo").innerHTML = text;
</script>