While statement

Example of simple 'while' loop statement in JavaScript.
var text = "Count to 10:  <br>";
var i = 0;

while (i <= 10) {
    text +=  i + "<br>";
    i++;
}

Responses

0 Replies