JS Break & Continue Statement


Continue Statement

<!DOCTYPE html>
<html>
<head>
  <title>JavaScript</title>
  <script>
    for(var a = 1; a <= 10; a++){
      if(a == 3){
        document.write("Hey : " + a + "<br>");
        continue;
      }
      document.write("Number : " + a + "<br>");
    }
  </script>
</head>
<body>
</body>
</html>


Break Statement

<!DOCTYPE html>
<html>
<head>
  <title>JavaScript</title>
  <script>
    for(var a = 1; a <= 10; a++){
      if(a == 3){
        document.write("Hey : " + a + "<br>");
        break;
      }
      document.write("Number : " + a + "<br>");
    }
  </script>
</head>
<body>
</body>
</html>