Önkénteseink még nem fordították le ezt a cikket magyar nyelvre. Csatlakozzon, és segítsen a munka befejezésében!
Elolvashatja a cikket English (US) nyelven is.

This chapter documents all the JavaScript language operators, expressions and keywords.

Expressions and operators by category

For an alphabetical listing see the sidebar on the left.

Primary expressions

Basic keywords and general expressions in JavaScript.

this
The this keyword refers to a special property of an execution context.
function
The function keyword defines a function expression.
class
The class keyword defines a class expression.
function*
The function* keyword defines a generator function expression.
yield
Pause and resume a generator function.
yield*
Delegate to another generator function or iterable object.
async function
The async function defines an async function expression.
await
Pause and resume an async function and wait for the promise's resolution/rejection.
[]
Array initializer/literal syntax.
{}
Object initializer/literal syntax.
/ab+c/i
Regular expression literal syntax.
( )
Grouping operator.

Left-hand-side expressions

Left values are the destination of an assignment.

Property accessors
Member operators provide access to a property or method of an object
(object.property and object["property"]).
new
The new operator creates an instance of a constructor.
new.target
In constructors, new.target refers to the constructor that was invoked by new.
super
The super keyword calls the parent constructor.
...obj
Spread syntax allows an expression to be expanded in places where multiple arguments (for function calls) or multiple elements (for array literals) are expected.

Increment and decrement

Postfix/prefix increment and postfix/prefix decrement operators.

A++
Postfix increment operator.
A--
Postfix decrement operator.
++A
Prefix increment operator.
--A
Prefix decrement operator.

Unary operators

A unary operation is operation with only one operand.

delete
The delete operator deletes a property from an object.
void
The void operator discards an expression's return value.
typeof
The typeof operator determines the type of a given object.
+
The unary plus operator converts its operand to Number type.
-
The unary negation operator converts its operand to Number type and then negates it.
~
Bitwise NOT operator.
!
Logical NOT operator.

Arithmetic operators

Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value.

+
Addition operator.
-
Subtraction operator.
/
Division operator.
*
Multiplication operator.
%
Remainder operator.
**
Exponentiation operator.

Relational operators

A comparison operator compares its operands and returns a Boolean value based on whether the comparison is true.

in
The in operator determines whether an object has a given property.
instanceof
The instanceof operator determines whether an object is an instance of another object.
<
Less than operator.
>
Greater than operator.
<=
Less than or equal operator.
>=
Greater than or equal operator.

Note: => is not an operator, but the notation for Arrow functions.

Equality operators

The result of evaluating an equality operator is always of type Boolean based on whether the comparison is true.

==
Equality operator.
!=
Inequality operator.
===
Identity operator.
!==
Nonidentity operator.

Bitwise shift operators

Operations to shift all bits of the operand.

<<
Bitwise left shift operator.
>>
Bitwise right shift operator.
>>>
Bitwise unsigned right shift operator.

Binary bitwise operators

Bitwise operators treat their operands as a set of 32 bits (zeros and ones) and return standard JavaScript numerical values.

&
Bitwise AND.
|
Bitwise OR.
^
Bitwise XOR.

Binary logical operators

Logical operators are typically used with boolean (logical) values, and when they are, they return a boolean value.

&&
Logical AND.
||
Logical OR.

Conditional (ternary) operator

(condition ? ifTrue : ifFalse)

The conditional operator returns one of two values based on the logical value of the condition.

Assignment operators

An assignment operator assigns a value to its left operand based on the value of its right operand.

=
Assignment operator.
*=
Multiplication assignment.
/=
Division assignment.
%=
Remainder assignment.
+=
Addition assignment.
-=
Subtraction assignment
<<=
Left shift assignment.
>>=
Right shift assignment.
>>>=
Unsigned right shift assignment.
&=
Bitwise AND assignment.
^=
Bitwise XOR assignment.
|=
Bitwise OR assignment.
[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.

Comma operator

,
The comma operator allows multiple expressions to be evaluated in a single statement and returns the result of the last expression.

Non-standard features

Expression closures Obsolete since Gecko 60
The expression closure syntax is a shorthand for writing simple function.
Legacy generator function Obsolete since Gecko 58
The 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
Array comprehensions.
(for (x of y) y) Obsolete since Gecko 58
Generator comprehensions.

Specifications

Specification Status Comment
ECMAScript 1st Edition (ECMA-262)
The definition of 'Expressions' in that specification.
Standard Initial definition
ECMAScript 5.1 (ECMA-262)
The definition of 'Expressions' in that specification.
Standard  
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'ECMAScript Language: Expressions' in that specification.
Standard New: Spread syntax, rest syntax, destructuring assignment, super keyword.
ECMAScript Latest Draft (ECMA-262)
The definition of 'ECMAScript Language: Expressions' in that specification.
Draft  

Browser compatibility

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung InternetNode.js
Array comprehensions
DeprecatedNon-standard
Chrome No support NoEdge No support NoFirefox No support 30 — 58IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android No support 30 — 58Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
async function expressionChrome Full support 55Edge Full support 15Firefox Full support 52IE No support NoOpera Full support 42Safari Full support 10.1WebView Android Full support 55Chrome Android Full support 55Edge Mobile Full support 15Firefox Android Full support 52Opera Android Full support 42Safari iOS Full support 10.1Samsung Internet Android Full support 6.0nodejs Full support 7.6.0
Full support 7.6.0
Full support 7.0.0
Disabled
Disabled From version 7.0.0: this feature is behind the --harmony runtime flag.
awaitChrome Full support 55Edge Full support YesFirefox Full support 52IE ? Opera Full support 42Safari Full support 10.1WebView Android Full support 55Chrome Android Full support 55Edge Mobile Full support YesFirefox Android Full support 52Opera Android Full support 42Safari iOS Full support 10.1Samsung Internet Android Full support 6.0nodejs Full support 7.6.0
Full support 7.6.0
Full support 7.0.0
Disabled
Disabled From version 7.0.0: this feature is behind the --harmony runtime flag.
classChrome Full support 42Edge Full support YesFirefox Full support 45IE No support NoOpera Full support YesSafari Full support YesWebView Android Full support 42Chrome Android Full support 42Edge Mobile Full support YesFirefox Android Full support 45Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support 4.0nodejs Full support 6.0.0
Full support 6.0.0
Full support 5.0.0
Disabled
Disabled From version 5.0.0: this feature is behind the --harmony runtime flag.
Comma operatorChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support 3Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
Conditional operator (c ? t : f)Chrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
deleteChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
Destructuring assignmentChrome Full support 49Edge Full support 14Firefox Full support 41
Notes
Full support 41
Notes
Notes Firefox provided a non-standard destructuring implementation from Firefox 2 to 40.
IE No support NoOpera Full support YesSafari Full support 8WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support 14Firefox Android Full support 41
Notes
Full support 41
Notes
Notes Firefox provided a non-standard destructuring implementation from Firefox 2 to 40.
Opera Android Full support YesSafari iOS Full support 8Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
Expression closures
DeprecatedNon-standard
Chrome No support NoEdge No support NoFirefox No support 3 — 60IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android No support 4 — 60Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
functionChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
function*Chrome Full support YesEdge Full support YesFirefox Full support 26IE No support NoOpera Full support YesSafari Full support 10WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 26Opera Android Full support YesSafari iOS Full support 10Samsung Internet Android Full support Yesnodejs Full support Yes
Generator comprehensions
DeprecatedNon-standard
Chrome No support NoEdge No support NoFirefox No support 30 — 58IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android No support 30 — 58Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
Grouping operator ()Chrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
inChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
instanceofChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
Legacy generator function
DeprecatedNon-standard
Chrome No support NoEdge No support NoFirefox No support 2 — 58IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android No support 4 — 58Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
newChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
new.targetChrome Full support 46Edge Full support YesFirefox Full support 41IE No support NoOpera Full support YesSafari Full support YesWebView Android Full support 46Chrome Android Full support 46Edge Mobile Full support YesFirefox Android Full support 41Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support 5.0nodejs Full support 5.0.0
Object initializerChrome Full support 1Edge Full support YesFirefox Full support 1IE Full support 1Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Edge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support Yesnodejs Full support Yes
Pipeline operator (|>)
Experimental
Chrome No support NoEdge No support NoFirefox Full support 58
Disabled
Full support 58
Disabled
Disabled From version 58: this feature is behind the --enable-pipeline-operator compile flag.
IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android Full support 58
Disabled
Full support 58
Disabled
Disabled From version 58: this feature is behind the --enable-pipeline-operator compile flag.
Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
Property accessorsChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
superChrome Full support 42Edge Full support YesFirefox Full support 45IE No support NoOpera Full support YesSafari Full support YesWebView Android Full support 42Chrome Android Full support 42Edge Mobile Full support YesFirefox Android Full support 45Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support 4.0nodejs Full support Yes
thisChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
typeofChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
voidChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
yieldChrome Full support 39Edge Full support YesFirefox Full support 26
Notes
Full support 26
Notes
Notes Starting with Firefox 33, the parsing of the yield expression has been updated to conform with the ES2015 specification.
IE No support NoOpera Full support YesSafari Full support 10WebView Android Full support 39Chrome Android Full support 39Edge Mobile Full support YesFirefox Android Full support 26
Notes
Full support 26
Notes
Notes Starting with Firefox 33, the parsing of the yield expression has been updated to conform with the ES2015 specification.
Opera Android Full support YesSafari iOS Full support 10Samsung Internet Android Full support 4.0nodejs Full support 4.0.0
Full support 4.0.0
Full support 0.12
Disabled
Disabled From version 0.12: this feature is behind the --harmony runtime flag.
yield*Chrome Full support YesEdge Full support YesFirefox Full support 27
Notes
Full support 27
Notes
Notes Starting with Firefox 33, the parsing of the yield expression has been updated to conform with the ES2015 specification.
IE No support NoOpera Full support YesSafari Full support 10WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 27
Notes
Full support 27
Notes
Notes Starting with Firefox 33, the parsing of the yield expression has been updated to conform with the ES2015 specification.
Opera Android Full support YesSafari iOS Full support 10Samsung Internet Android Full support Yesnodejs Full support 4.0.0
Full support 4.0.0
Full support 0.12
Disabled
Disabled From version 0.12: this feature is behind the --harmony runtime flag.

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.

See also