anonymous
14 years ago
var i=0;
for (i=0;i<=10;i++)
{
if (i==3)
{
break;
}
document.write("The number is " + i);
document.write("
");
}
I know it very well that this break command will terminate the loop as the value of the variable reaches to 3 but my question is why we use break instead of making our condition like i<=3.
Can someone make it clear with some practical example...