Easy Tutorial
❮ Prop Submit Name Prop Textarea Value ❯

JavaScript Statement Reference Manual


JavaScript Statements

In HTML, JavaScript statements are "commands" sent to the browser.

They tell the browser what to do.

The following JavaScript statement example tells the browser to output "Hello Dolly" into the HTML element with id="demo":

Example

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

For more tutorials on statements, please refer to our JavaScript Statements Tutorial.


JavaScript Statement Identifiers

JavaScript statements are typically identified by a statement identifier to specify the JavaScript operation to be performed.

Statement identifiers are reserved keywords and cannot be used as variable names.

The following table lists all JavaScript statements:

Statement Description
break Exits a switch statement or a loop
continue Skips the current iteration in a loop and continues with the next iteration
debugger Stops the execution of JavaScript and calls the debugging function
do ... while Executes a block of statements and repeats the block while a condition is true
for Executes a block of code a specified number of times while a condition is true
for ... in Iterates over the properties of an object or elements of an array
function Defines a function
if ... else ... else if Executes different actions based on different conditions
return Exits a function and returns a value from the function
switch Executes different actions based on different conditions
throw Throws (generates) an error
try ... catch ... finally Implements error handling with catch
var Declares a variable
while Executes a block of statements while a condition is true
❮ Prop Submit Name Prop Textarea Value ❯