UNB/ CS/ David Bremner/ teaching/ cs2613/ books/ mdn/ Reference/ Expressions and operators

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. These expressions have the highest precedence (higher than operators).

Left-hand-side expressions

Left values are the destination of an assignment.

Increment and decrement

Postfix/prefix increment and postfix/prefix decrement operators.

Unary operators

A unary operation is an operation with only one operand.

Arithmetic operators

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

Relational operators

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

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.

Bitwise shift operators

Operations to shift all bits of the operand.

Binary bitwise operators

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

Binary logical operators

Logical operators implement boolean (logical) values and have short-circuiting behavior.

Conditional (ternary) operator

Assignment operators

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

Yield operators

Spread syntax

Comma operator

Specifications

Browser compatibility

See also