
Operators are the special symbols that performs some specific mathematical or logical calculations. The value that the operator operates on is called the operand. For example: a+b. Here, + is the operator that performs addition, a and b are the operands. In JavaScript, operator returns a value.
| S.No | Operator Category | Operator Symbols Operator Name |
|---|---|---|
| Arithmetic Operators: (Return Number data type) | + Addition, String Concatenation - Subtraction / Division * Multiplication % Modulas (Remainder) ** Exponentiation (Power) | |
| Comparison/Relational Operators: (Return Boolean datatype) | > Greater than < Less than >= Greater than equals to <= Less than equals to != Not equals to == Equals to === Strict equal !== Strict not equal | |
| Logical operators | && And || Or ! Not ?? Nullish coalescing | |
| Conditional Operator | ? : Ternary Operator | |
| Assignment operators | = Assignment Operator += Add and Assignment -= Subtract and Assignment *= Multiply and Assignment /= Divide and Assignment %= Modules and Assignment | |
| Increment/Decrement operators | a++ Post Increment ++a Pre Increment a-- Post Decrement --a Pre Decrement | |
| Bitwise Operator | & AND | OR ^ XOR ~ NOT << Left Shift >> Right Shift >>> Zero-Fill Right Shift | |
| Comma Operator | , Comma |
| Rank | Operator | Description | Associativity |
|---|---|---|---|
| ( ) | Parentheses | left-to-right | |
| ++ , -- | Pre-increment/pre-decrement | right-to-left | |
| * , / , % | Multiplication, division, modulus | left-to-right | |
| + , - | Addition, subtraction | left-to-right | |
| < , > , <= , >= | Relational: less than, less than or equals to, greater than, greater than or equals to | left-to-right | |
| == , != | Relational: is equal to/is not equal to | left-to-right | |
| ++ , -- | Post-increment/post-decrement | right-to-left | |
| && | Logical AND | left-to-right | |
| || , ?? | Logical OR, Nullish coalescing | left-to-right | |
| ?: | Ternary conditional | right-to-left | |
| = -= += >= <= | Assignment | right-to-left |
Ad: