For an alphabetical listing see the sidebar on the left.
Basic keywords and general expressions in JavaScript.
this
this
keyword refers to a special property of an execution context.function
function
keyword defines a function expression.class
class
keyword defines a class expression.function*
function*
keyword defines a generator function expression.yield
yield*
async function
async function
defines an async function expression.await
[]
{}
/ab+c/i
( )
Left values are the destination of an assignment.
object.property
and object["property"]
).new
new
operator creates an instance of a constructor.new.target
refers to the constructor that was invoked by new
.super
super
keyword calls the parent constructor....obj
Postfix/prefix increment and postfix/prefix decrement operators.
A++
A--
++A
--A
A unary operation is operation with only one operand.
delete
delete
operator deletes a property from an object.void
void
operator discards an expression's return value.typeof
typeof
operator determines the type of a given object.+
-
~
!
Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value.
+
-
/
*
%
**
A comparison operator compares its operands and returns a Boolean
value based on whether the comparison is true.
in
in
operator determines whether an object has a given property.instanceof
instanceof
operator determines whether an object is an instance of another object.<
>
<=
>=
Note: => is not an operator, but the notation for Arrow functions.
The result of evaluating an equality operator is always of type Boolean
based on whether the comparison is true.
Operations to shift all bits of the operand.
<<
>>
>>>
Bitwise operators treat their operands as a set of 32 bits (zeros and ones) and return standard JavaScript numerical values.
Logical operators are typically used with boolean (logical) values, and when they are, they return a boolean value.
(condition ? ifTrue : ifFalse)
The conditional operator returns one of two values based on the logical value of the condition.
An assignment operator assigns a value to its left operand based on the value of its right operand.
=
*=
/=
%=
+=
-=
<<=
>>=
>>>=
&=
^=
|=
[a, b] = [1, 2]
{a, b} = {a:1, b:2}
Destructuring assignment allows you to assign the properties of an array or object to variables using syntax that looks similar to array or object literals.
,
function
keyword can be used to define a legacy generator function inside an expression. To make the function a legacy generator, the function body should contains at least one yield
expression.[for (x of y) x]
Obsolete since Gecko 58(for (x of y) y)
Obsolete since Gecko 58本章介绍如何使用 JavaScript函数 来开发应用程序。