An operators are used to perform a mathematical operation on single or multiple operands. There are various operators available in JavaScript, which are categorized into 5 parts-
Arithmetic Operators:-
Operator | Description |
---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Modulus (Remainder of a division) |
++ | Increment |
__ | Decrement |
Assignment Operators:-
Operator | Description |
---|---|
= | Assign |
+= | Add and assign |
-= | Subtract and assign |
*= | Multiply and assign |
/= | Divide and assign |
%= | Modulus and assign |
Comparison Operators:-
Operator | Description |
---|---|
== | Equal to |
=== | Identical (Equal value and equal type) |
!= | Not equal to |
!== | Not identical (Not equal value or not equal type) |
> | Greater than |
>= | Greater than or equal to |
< | Less than |
<= | Less than or equal to |
Boolean or Logical Operators:-
Operator | Description |
---|---|
&& | Logical AND |
|| | Logical OR |
! | Logical NOT |
String Operators:-
Operator | Description |
---|---|
= | Assignment |
+ | Concatenate (Join two strings together) |
+= | Concatenate and assign |