Showing posts with label Break. Show all posts
Showing posts with label Break. Show all posts
The break statement will break the loop and continue executing the code that follows after the loop (if any).

Example



<html>
<body>
<script type="text/javascript">
var i=0;
for (i=0;i<=10;i++)
  {
  if (i==3)
    {
    break;
    }
  document.write("The number is " + i);
  document.write("<br />");
  }
</script>
</body>
</html>