Welcome to Bucaro TecHelp!

Bucaro TecHelp
HTTPS Encryption not required because no account numbers or
personal information is ever requested or accepted by this site

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

The continue Statement

While the break statement completely terminates a loop, causing program flow to exit the loop, the continue statement terminates only one iteration of a loop, skipping the rest of the code in the loop’s body and returning program flow to the loop control statement at the top of the loop.

for(var i = 0; i < 5; i++)
{
  if(i == 2) continue;
  document.write("The value of i is: " + i + "<br />");
}

The code above will write every value of i from 1 to 4 except 2 because when the value of i is 2, the continue statement causes the document.write statement to be skipped.

In loops that contain a large block of code, if you know a certain value in an iteration does not require processing by that block of code, you can use the continue statement to skip that code and move on to the next iteration of the loop.

More Java Script Code:
• Remove Blank Spaces From Ends of a String
• Include a Quote Character in a String
• Define Lines in a String
• Extract Part of a String
• JavaScript to Concatenate Strings
• The if/else Structure
• Java Script Arithmetic Operators
• Java Script Quick Reference : JavaScript toString Method Converts a Number to a String
• Java Script prompt Message Box
• Java Script Events

RSS Feed RSS Feed

Follow Stephen Bucaro Follow @Stephen Bucaro


Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2024 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268