Articles → JAVASCRIPT → Break and continue in JavaScript

Break and continue in JavaScript





  1. Software requirement
  2. Prerequisite knowledge
  3. What is break statement?
  4. Example of break statement
  5. What is continue statement?
  6. Example of continue statement

Software requirement




  1. Windows any version is installed on your machine.
  2. Notepad or any text editor for writing code.

Prerequisite knowledge




  1. Basic knowledge of JavaScript.
  2. Basic knowledge of HTML.
  3. Knowledge of any programming language is an added advantage.

What is break statement?





Example of break statement




<script type = "text/javascript">
    for (i = 0; i < 10; i++) {
        document.write(i);

        if (i == 5)
            break;
    }
</script>





What is continue statement





Example of continue statement




<script type="text/javascript">
    for (i = 0; i < 10; i++) {
        if (i == 5)
            continue;
        document.write(i);
    }
</script>





Posted By  -  Karan Gupta
 
Posted On  -  Friday, March 22, 2013

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250