Looping Statements : By using loops we can execute a set of statements multiple times based on the conditions.
For:
<script>
for(ini;con;inc/dec)
for(ini;con;inc/dec)
{
stt
}
</script>
stt
}
</script>
Ini = initialization; cin = Condition; inc = increment; dec = decrement.
Loops :
Very Very Important Interview Question.
Sample Script :
<script>
no=20
for(i=1; i<=100; i++)
{
document.write(i+"X"+no+"="+i*no)
document.write("<br>");
}
</script>
no=20
for(i=1; i<=100; i++)
{
document.write(i+"X"+no+"="+i*no)
document.write("<br>");
}
</script>
While loop:
Sample Script.
<script>
i=5
do
{
alert(i)
i++
}
while(i<1)
</script>
i=5
do
{
alert(i)
i++
}
while(i<1)
</script>
0 comments:
Post a Comment