Operators Reference
A quick reference of JavaScript operators.
Arithmetic
| Operator | Meaning |
|---|
+ | addition |
- | subtraction |
* | multiplication |
/ | division |
% | remainder |
** | exponent |
++ | increment |
-- | decrement |
Assignment
| Operator | Meaning |
|---|
= | assign |
+= | add and assign |
-= | subtract and assign |
*= | multiply and assign |
/= | divide and assign |
Comparison
| Operator | Meaning |
|---|
== | loose equal |
=== | strict equal |
!= | loose not equal |
!== | strict not equal |
>, < | greater/less than |
>=, <= | greater/less or equal |
Logical
| Operator | Meaning |
|---|
&& | AND |
| ` | | ` | OR |
! | NOT |
?? | nullish coalescing |
typeof and instance
typeof checks a value's type. instanceof checks if an object is an instance of a class.
TL;DR
- Arithmetic: + - / % * ++ --.
- Assignment shorthands: += -= *= /=.
- Use === and !== for safe comparisons.
- Logical: && || ! ??.