JavaScript Operators
By Flavio Copes
Learn how JavaScript operators combine expressions into more complex ones, from binary operators like addition to unary operators and the ternary operator.
~~~
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.
~~~
Related posts about js: