In this post, we will learn how a For Loop work in JavaScript.
The code is
<script>
function myFunc(){
var text = "";
var i;
for (i = 0; i < 10; i++) {
text += i + "<br>";
}
document.getElementById("demo").innerHTML = text;
}
</script>
The result is as follows:
The result will appear here