statements
Summary
The following table lists JavaScript statements.
Syntax
Statements
Description | Language Element |
---|---|
break | Terminates the current loop, or if in conjunction with a label , terminates the associated statement. |
Comment | Causes comments to be ignored by the JavaScript parser. |
continue | Stops the current iteration of a loop, and starts a new iteration. |
debugger | Starts the debugger. |
do…while | Executes a statement block once, and then repeats execution of the loop until a condition expression evaluates to false. |
for | Executes a block of statements for as long as a specified condition is true. |
for…in | Executes one or more statements for each element of an object or array. |
function | Declares a new function. |
if…else | Conditionally executes a group of statements, depending on the value of an expression. |
Labeled | Provides an identifier for a statement. |
return | Exits from the current function and returns a value from that function. |
switch | Enables the execution of one or more statements when a specified expression’s value matches a label. |
this | Refers to the current object. |
throw | Generates an error condition that can be handled by a try…catch statement. |
try-catch-finally | Implements error handling for JavaScript. |
var | Declares a variable. |
while | Executes a statement until a specified condition is false. |
with | Establishes the default object for a statement. |
Attributions
Microsoft Developer Network: Article