
JavaScript Assignment Operators
Catalog
Click on this table of contents to jump to the corresponding section
JavaScript Assignment Operators
Assignment operators assign values to JavaScript variables.
| Operator | Example | Same As |
|---|---|---|
| = | x = y | x = y |
| += | x += y | x = x + y |
| -= | x -= y | x = x - y |
| *= | x *= y | x = x * y |
| /= | x /= y | x = x / y |
| %= | x %= y | x = x % y |
| **= | x **= y | x = x ** y |
Shift Assignment Operators
| Operator | Example | Same As |
|---|---|---|
| <<= | <<= x <<= y | x = x << y |
| >>= | x >>= y | x = x >> y |
| >>>= | x >>>= y | x = x >>> y |
Bitwise Assignment Operators
| Operator | Example | Same As |
|---|---|---|
| &= | x &= y | x = x & y |
| ^= | x ^= y | x = x ^ y |
| |= | x |= y | x = x | y |
Logical Assignment Operators
| Operator | Example | Same As |
|---|---|---|
| &&= | x &&= y | x = x && (x = y) |
| ||= | x ||= y | x = x || (x = y) |
| ??= | x ??= y | x = x ?? (x = y) |
Note: The logical assignment operators are ES2020
The = Operator
The Simple Assignment Operator assigns a value to a variable.
The += Operator
The Addition Assignment Operator adds a value to a variable.
The -= Operator
The Subtraction Assignment Operator subtracts a value from a variable.
The *= Operator
The Multiplication Assignment Operator multiplies a variable.
The **= Operator
The Exponentiation Assignment Operator raises a variable to the power of the operand.
The /= Operator
The Division Assignment Operator divides a variable.
The %= Operator
The Remainder Assignment Operator assigns a remainder to a variable.
The <<= Operator
The Left Shift Assignment Operator left shifts a variable.
The >>= Operator
The Right Shift Assignment Operator right shifts a variable (signed).
The >>>= Operator
The Unsigned Right Shift Assignment Operator right shifts a variable (unsigned).
The &= Operator
The Bitwise AND Assignment Operator does a bitwise AND operation on two operands and assigns the result to the the variable.
The |= Operator
The Bitwise OR Assignment Operator does a bitwise OR operation on two operands and assigns the result to the variable.
The ^= Operator
The Bitwise XOR Assignment Operator does a bitwise XOR operation on two operands and assigns the result to the variable.
The &&= Operator
The Logical AND assignment operator is used between two values. If the first value is true, the second value is assigned.
The &&= operator is an ES2020 feature.
The ||= Operator
The Logical OR assignment operator is used between two values. If the first value is false, the second value is assigned.
The ??= Operator
The Nullish coalescing assignment operator is used between two values. If the first value is undefined or null, the second value is assigned.
The ??= operator is an ES2020 feature.
Lily and 4 people like this
Prev Post
Space The Final Frontier
Next Post
Telescopes 101
0 Comments
Leave a Reply
Recent Post

SMOTE for Imbalanced Classification with Python
12:28:00 16/05/2026

CLAHE Histogram Equalization with OpenCV: A Python Guide
12:06:00 16/05/2026

Histogram Equalization in Digital Image Processing
10:56:00 16/05/2026

Gaussian Noise Explained: What It Is and How It Works
10:36:00 16/05/2026

Python Image Blurring with OpenCV: Gaussian, Median & Bilateral Filter Guide
09:59:00 16/05/2026
Related Topics
Feeds
Don't miss what's next 👋
Enjoyed this content? Leave your email to get notified when we publish new insights, tutorials, and updates — no spam, ever.

