Make the loop start counting downwards from 10 and stop at 1. The output should be 10 9 8 7 6 5 4 3 2 1 with line breaks. - Javascript Statement

Javascript examples for Statement:Quiz

Description

Make the loop start counting downwards from 10 and stop at 1. The output should be 10 9 8 7 6 5 4 3 2 1 with line breaks.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

<script>
var i;/* w  ww.ja  v a2s. c om*/
for (i = 10; i > 0; i--) {
    document.getElementById("demo").innerHTML += i + "<br/>";
}
</script>

</body>
</html>

Related Tutorials