जावास्क्रिप्ट में लूप्स (Javascript in loops)
For लूप्स :- फांर लूूप का प्रयोग कब किया जाता है जब हमें यह मालूम हो कि script को कितनी बार एक्सीक्यूट कराना है। इसका सिंटेक्स है।
for (var=startvalue;var<=endvalue;var+increment)
{
code to be executed
<html>
<body>
<script type=“text/javascript”>
var i=0;
for (i=0;i<=5;i++)
{
document.write(“the number is “ + i);
document.write(“<br/>“)
}
</script>
</body>
</html>
output :
The number is 0
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5