JavaScript Statements (and Directives):
Reserved Words
[this page | pdf | back links]
JavaScript
statements identify instructions that are executed by the web browser. A
summary of JavaScript statements is given here.
A list of the main statement
reserved words recognised by JavaScript is shown here:
Statement
|
Description
|
More
|
break
|
Exits a switch or loop
|
Here
|
class
|
Defines a class
|
Here
|
const
|
Declares a constant
|
Here
|
continue
|
Breaks
an iteration (in a loop) if a specific condition occurs, moving on to the
next iteration
|
Here
|
debugger
|
Stops execution of
JavaScript and calls the debugging capability if available
|
|
do … while
|
Executes
a block of statements, then repeats the block while the condition remains
true
|
Here
|
for
|
Marks a block of
statements to be executed whilst a condition is true
|
Here
|
for … in
|
Marks
a block of statements to be executed for each element of an object
|
Here
|
function
|
Declares a function
|
Here
|
if … else if … else
|
Marks
a block of statements to be executed depending on a condition
|
Here
|
let
|
Declares a variable
(with block scope)
|
Here
|
return
|
Stops
execution of a function and returns a value from
that function
|
Here
|
switch
|
Marks a block of statements to be executed depending on
different cases
|
Here
|
this
|
Used to access the
properties and methods of the object that has defined the relevant object
|
Here
|
throw
|
Throws an error object
as part of implementing error handling
|
Here
|
try … catch … finally
|
Implements error
handling
|
Here
|
var
|
Declares a variable
(with global or function scope)
|
Here
|
while
|
Identifies
block of statements that is repeatedly executed while a condition is true
|
Here
|
Most JavaScript programs
contain many statements, which are executed one by one in the order in which
they are written except when statement flow control is adjusted as above.
Some reserved words are
in practice limited to class
definitions, including:
Statement
|
Description
|
More
|
class
|
Defines a class
|
Here
|
extends
|
Allows one class to
inherit the methods and properties of another class
|
Here
|
get
|
Used to get a class
property
|
Here
|
set
|
Used to set a class
property
|
Here
|
static
|
Used to define a method
on the class itself rather than on individual instances of the class
|
Here
|
super
|
Breaks an iteration (in
a loop) if a specific condition occurs, moving on to the next iteration
|
Here
|
The this reserved word, see here, is often
also used in classes, although it has more general application. Code in classes
automatically needs to be in strict mode,
other code can be forced to be in strict mode using the use strict directive.
Set out below is a list
of JavaScript reserved words (which cannot be used as variables, labels or
function names):
abstract**
|
arguments
|
await*
|
boolean**
|
break
|
byte**
|
case
|
catch
|
char**
|
class*
|
const
|
continue
|
debugger
|
default
|
delete
|
do
|
double**
|
else
|
enum*
|
eval
|
export*
|
extends*
|
false
|
final**
|
finally
|
float**
|
for
|
function
|
goto**
|
if
|
implements
|
import*
|
in
|
instanceof
|
int**
|
interface
|
let*
|
long**
|
native**
|
new
|
null
|
package
|
private
|
protected
|
public
|
return
|
short**
|
static
|
super*
|
switch
|
synchronized**
|
this
|
throw
|
throws**
|
transient**
|
true
|
try
|
typeof
|
var
|
void
|
volatile**
|
while
|
with
|
yield
|
* Are new in ECMAScript 5
and 6
** Removed from the ECMAScript
5/6 standard, but it is recommended not to use them, because at the time of
writing ECMAScript 5/6 was not fully supported by all browsers.
NAVIGATION LINKS
Contents | Prev | Next | JavaScript Reserved Words