Use do/while loop to output 0 1 2 3 4. - Javascript Statement

Javascript examples for Statement:Quiz

Description

Use do/while loop to output 0 1 2 3 4.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
var i = 0;
do {//www . j ava  2  s  .  com
    document.getElementById("demo").innerHTML += i + "<br>";
    i++;
}
while (i < 5)
</script>

</body>
</html>

Related Tutorials