In this tutorial, we will learn about Operators in JavaScript. Operators are special symbols and we use these operators to perform some operation on operands. For example, we want to add two number 5 and 10 so we will use the + operator there to add these two numbers.

JavaScript provides us with a variety of operators. These operators are categorized into these following categories.

- Arithmetic Operators
- Relational Operators
- Bitwise Operators
- Logical Operators
- Assignment Operators

Now we will check all these operators in detail. we will check each category.

## Arithmetic Operators:

Arithmetic Operators are used to performing normal mathematical operations. For example to perform addition, subtraction. We have a total of five operators in this category.

Operator |
Description |
Example |
---|---|---|

+ | Addition | 10+20 = 30 |

– | Subtraction | 20-10 = 10 |

* | Multiplication | 10*20 = 200 |

/ | Division | 20/10 = 2 |

% | Modulus | 20%10 = 0 |

## Relational Operators:

Relational Operators are used to performing check relation between two operands operations. For example, check less than or greater than. We have a total of eight operators in this category.

Operator |
Description |
Example |
---|---|---|

== | Is equal to | 10==20 = false |

=== | Identical (equal and of same type) | 10==20 = false |

!= | Not equal to | 10!=20 = true |

!== | Not Identical | 20!==20 = false |

> | Greater than | 20>10 = true |

>= | Greater than or equal to | 20>=10 = true |

< | Less than | 20<10 = false |

<= | Less than or equal to | 20<=10 = false |

## Bitwise Operators:

Bitwise Operators are work on the bit level of the operand. We have a total of seven operators in this category.

Operator |
Description |
Example |
---|---|---|

& | Bitwise AND | (10==20 & 20==33) = false |

| | Bitwise OR | (10==20 | 20==33) = false |

^ | Bitwise XOR | (10==20 ^ 20==33) = false |

~ | Bitwise NOT | (~10) = -10 |

<< | Bitwise Left Shift | (10<<2) = 40 |

>> | Bitwise Right Shift | (10>>2) = 2 |

>>> | Bitwise Right Shift with Zero | (10>>>2) = 2 |

## Logical Operators:

Logical Operators are work between two expressions. We have a total of three operators in this category.

Operator |
Description |
Example |
---|---|---|

&& | Logical AND | (10==20 && 20==33) = false |

|| | Logical OR | (10==20 || 20==33) = false |

! | Logical Not | !(10==20) = true |

## Assignment Operators:

Assignment Operators are normally used to assign value to a variable. We have a total of six operators in this category.

Operator |
Description |
Example |
---|---|---|

= | Assign | var a=10; |

+= | Add and assign | var a=10; a+=20; Now a = 30 |

-= | Subtract and assign | var a=20; a-=10; Now a = 10 |

*= | Multiply and assign | var a=10; a*=20; Now a = 200 |

/= | Divide and assign | var a=10; a/=2; Now a = 5 |

%= | Modulus and assign | var a=10; a%=2; Now a = 0 |