JavaScript Statement Reference Manual

JavaScript Statements

In HTML, JavaScript statements are the "instructions" that a web browser is to "execute".

This statement tells the browser to write "Hello Kitty" in the HTML element with id="demo":

Example

document.getElementById("demo").innerHTML = "Hello Kitty";

Try It Yourself

For more information about statements, please read our JavaScript Statement Tutorial.

JavaScript Statement Identifiers

JavaScript statements usually start with a statement identifier to indicate the JavaScript action to be executed.

Statement identifiers are reserved words and cannot be used as variable names (or anything else).

The following table lists all JavaScript statement identifiers:

Statement Description
break Exit the switch or loop.
class Declare a class.
const Declare a variable with a constant value.
continue If a specified condition occurs, interrupt the loop (in the loop) once and continue to the next iteration in the loop.
debugger Stop executing JavaScript and call debugging features (if any).
do ... while Execute a statement block and repeat the statement block when the condition is true.
for Loop through a code block multiple times.
for ... in Loop through the properties of an object.
for ... of Loop through the values of an iterable object.
function Declare a function.
if ... else ... else if Mark the statement block to be executed based on a condition.
let Declare a variable within the scope of the braces {}.
return Stop executing the function and return from the function.
switch Mark the statement block to be executed based on different conditions.
throw Throw (generate) an error.
try ... catch ... finally Mark the statement block to be executed when an error occurs in the try block, and implement error handling.
var Declare a variable.
while Statement block to be executed when the condition is marked as true.