Assignment Operators
Compound assignment is shorthand operator:
For
var num = 10;
num = num + 10;
The second line can be replaced with a compound assignment:
var num = 10;
num += 10;
Compound-assignment operators are listed as follows:
Meaning | Operator |
---|---|
Multiply/assign | *= |
Divide/assign | /= |
Modulus/assign | %= |
Add/assign | += |
Subtract/assign | -= |
Left shift/assign | <<= |
Signed right shift/assign | >>= |
Unsigned right shift/assign | >>>= |
Home
JavaScript Book
Language Basics
JavaScript Book
Language Basics
Operators:
- JavaScript Operators
- Increment/Decrement Operators
- Increment/Decrement Operators for String, Boolean, Floating-point and Object
- Unary Plus and Minus
- Bitwise Not operator
- Bitwise AND
- Bitwise OR
- Bitwise XOR
- Left Shift
- Signed Right Shift
- Unsigned Right Shift
- Logical NOT
- Logical AND
- Logical OR
- Multiply
- Divide
- Modulus
- Add
- Subtract
- Relational Operators
- Equal and Not Equal
- Identically Equal and Not Identically Equal
- Conditional Operator
- Assignment Operators
- Comma Operator