This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

statements

Summary

The following table lists JavaScript statements.

Syntax

Statements

DescriptionLanguage Element
breakTerminates the current loop, or if in conjunction with a label , terminates the associated statement.
CommentCauses comments to be ignored by the JavaScript parser.
continueStops the current iteration of a loop, and starts a new iteration.
debuggerStarts the debugger.
do…whileExecutes a statement block once, and then repeats execution of the loop until a condition expression evaluates to false.
forExecutes a block of statements for as long as a specified condition is true.
for…inExecutes one or more statements for each element of an object or array.
functionDeclares a new function.
if…elseConditionally executes a group of statements, depending on the value of an expression.
LabeledProvides an identifier for a statement.
returnExits from the current function and returns a value from that function.
switchEnables the execution of one or more statements when a specified expression’s value matches a label.
thisRefers to the current object.
throwGenerates an error condition that can be handled by a try…catch statement.
try-catch-finallyImplements error handling for JavaScript.
varDeclares a variable.
whileExecutes a statement until a specified condition is false.
withEstablishes the default object for a statement.

Attributions

  • Microsoft Developer Network: Article