Page 199 - Web Applications (803) Class 12
P. 199
} while(num<=10);
</script>
</font>
</body>
</html>
Output of the preceding program is as follows:
Lab Assignment ‘n Activity Subject Enrichment
Complete the following activities and tick on the circle.
Watch the video for recall of loops - JavaScript Loops Explained | For Loop, While and
Do-While Loop | JavaScript Tutorial | Edureka : https://www.youtube.com/
watch?v=rJtN14OPpKc
Practice Question 1:
<html>
<body text="blue">
<h2>Calculate factorial using for loop</h2>
<font color=green>
<script>
var num=7;
var fact=1;
for (i=1;i<=num;i++){
fact = fact*i;
}
document.write("The factorial of "+num+" is "+fact);
</script>
</font>
</body> </html>
Web Scripting—JavaScript 197

