Operators
Arithmetic Operators
The arithmetic operators perform addition, subtraction, multiplication, division, exponentiation, and modulus operations.
- Addition(+)
- Subtraction (-)
- Multiplication(*)
- Division(/)
- Remainder of division (%)
- Exponentiation (**)
- Increment (++)
- Decrement (- -)
Example :
Assignment operators
An assignment operator assigns a value to its left operand based on the value of its right operand.
Comparison Operators
A comparison operator compares its operands and returns a logical value based on whether the comparison is true. The operands can be numerical, string, logical, or object values.
- Relational operator
- Equality operator
Equality Operators
1. Strict equality ( === )
The both value we have on the sides of this operator have the same type and same value2. Lose equality ( == )
The both value we have on the sides of this operator have the same value it won’t check typeTernary operator or conditional operator
The conditional operator is the only JavaScript operatorthat takes three operands: a condition followed by a question mark ( ? ), then an expression to execute if the condition is truthy followed by a colon ( : ), and finally the expression to execute if the condition is falsy.
Syntax
Example :
Logical Operators
There are three main logical operators.
AND Operator (&&)
If both conditions are true then it returns true else false.
Example :
OR Operator (||)
If any one condition is true then it returns true
Example :
NOT Operator (!)
If a condition is true, then the NOT operator will make it false.
Example :