• Home
  • About Us
  • Courses
  • Accreditation
  • FAQ
  • Academic Study Center
  • E-Learning
  • Contact Us
  • aecu

  • JavaScript Home
  • JavaScript Introduction
  • JavaScript How To
  • JavaScript Where To
  • JavaScript Statements
  • JavaScript Comments
  • JavaScript Variables
  • JavaScript Operators
  • JavaScript Comparisom
  • JavaScript If....Else
  • JavaScript Switch
  • JavaScript Popup Boxes
  • JavaScript Functions
  • JavaScript For Loop
  • JavaScript While Loop
  • JavaScript Break Loop
  • JavaScript For....In
  • JavaScript Events
  • JavaScript Try....Catch
  • JavaScript Throw
  • JavaScript Special Text
  • JavaScript Guidelines
  • JavaScript Ojects Intro
  • JavaScript String
  • JavaScript Date
  • JavaScript Array
  • JavaScript Boolean
  • JavaScript Math
  • JavaScript RegExp
  • JavaScript Brower
  • JavaScript Cookies
  • JavaScript Validation
  • JavaScript Animation
  • JavaScript Image Maps
  • JavaScript Timing
  • JavaScript Create Object
  • JavaScript Summary

  • Learn at your own pace

JavaScript Break and Continue Statements

Previous Chapter
Next Chapter

The break statement will break the loop and continue executing the code that follows after the loop (if any).


The break Statement
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>  
The continue Statement
The continue statement will break the current loop and continue with the next value.
Example
<html>
<body>
<script type="text/javascript">
var i=0
for (i=0;i<=10;i++)
  {
  if (i==3)
    {
    continue;
    }
  document.write("The number is " + i);
  document.write("<br />");
  }
</script>
</body>
</html>
Previous Chapter
Next Chapter
 

 
Home|
About Us|
Courses|
Accreditation|
FAQ|
Academic Study Center|
E-Learning|
Contact Us
©  AECU 2004-2010 , All rights Reserved