Lesson 9
Operators
Operators are special symbols that perform operations on one, two, or more operands (values or variables).
- Arithmetic Operators
- Assignment Operators
- Comparison Operators
- Logical Operators
- Unary Operators
- Ternary Operator
+
Arithmetic
Perform mathematical operations.
a + b, a - b=
Assignment
Assign values to variables.
a = b, a += b==
Comparison
Compare two values and return boolean.
a == b, a > b&&
Logical
Combine multiple conditions.
a && b, a || b!
Unary
Operate on a single operand.
++a, !a?
Ternary
Conditional operator (shorthand if-else).
a ? b : cJavaScript
Output
Your output will appear here...
- 1
( ) - 2
++ -- ! - 3
* / % - 4
+ - - 5
< <= > >= - 6
== != === !== - 7
&& - 8
|| - 9
? : - 10
= += -= *= /= %=
Higher precedence operators are evaluated first.
Use parentheses to change the order of evaluation.
let result = (2 + 3) * 4;Arithmetic
+, -, *, /, %, **Assignment
=, +=, -=, *=, /=, %=Comparison
==, !=, ===, !==, >, <, >=, <=Logical
&&, ||, !Unary
++, --, !, +, -Ternary
condition ? a : b