JavaScript Statements

The following table lists JavaScript statements.

Description

Language Element

Terminates the current loop, or if in conjunction with a label, terminates the associated statement.

break Statement

Contains statements to execute when an error occurs in code within the try block.

catch Statement

Activates conditional compilation support.

@cc_on Statement

Declares a new class.

class Statement

Causes comments to be ignored by the JavaScript parser.

Comment Statements

Declares a block-scoped variable with a constant value.

const

Stops the current iteration of a loop, and starts a new iteration.

continue Statement

Starts the debugger.

debugger Statement

Executes a statement block once, and then repeats execution of the loop until a condition expression evaluates to false.

do...while Statement

Executes a block of statements for as long as a specified condition is true.

for Statement

Executes one or more statements for each element of an object or array.

for...in Statement

Executes one or more statements for each value of an object or each element of an array.

for…of Statement

Declares a new function.

function Statement

Conditionally executes a group of statements, depending on the value of an expression.

@if Statement

Conditionally executes a group of statements, depending on the value of an expression.

if...else Statement

Provides an identifier for a statement.

Labeled Statement

Declares a block-scoped variable.

let

Exits from the current function and returns a value from that function.

return Statement

Creates variables used with conditional compilation statements.

@set Statement

Enables the execution of one or more statements when a specified expression's value matches a label.

switch Statement

Refers to the current object.

this Statement

Generates an error condition that can be handled by a try...catch statement.

throw Statement

Implements error handling for JavaScript.

try Statement

Declares a variable.

var Statement

Executes a statement until a specified condition is false.

while Statement

Establishes the default object for a statement.

with Statement

Show:
© 2015 Microsoft