javascript alll loops code example
Example 1: js for loops
let i;
for (i = 0; i < 6; ++i) {
console.log("Hello"); // print Hello 6 times
}
Example 2: looping in javascript
<html>
<body>
<script type = "text/javascript">
<!--
var count;
document.write("Starting Loop" + "<br />");
for(count = 0; count < 10; count++) {
document.write("Current Count : " + count );
document.write("<br />");
}
document.write("Loop stopped!");
//-->
</script>
<p>Set the variable to different value and then try...</p>
</body>
</html>