Operators allow you to get one or more simple expressions and combine them to form a more complex expression.
We can classify operators based on the operands they work with.
Most operators work with 2 operands:
- Addition (
+) - Subtraction (-)
- Division (/)
- Remainder (%)
- Multiplication (*)
- Exponentiation (**)
- Assignment (=)
- Comparison operators (
<,<=etc) - Equality checks (
==,!==etc) - Logical
andandor instanceofin
Some operators work with 1 operand:
- Increment (
++) - Decrement (
--) - Unary negation (
-) - Unary plus (
+) - Logical not (
!) newdeletetypeofawait- The spread operator
Just one operator works with 3 operands: the ternary operator.