---
title: "How many types of operator in JS also explain the example?"  
description: "How many types of operator in JS also explain the example?"  
author: "Ravi Vishwakarma"  
published: 2021-07-19  
canonical: https://answers.mindstick.com/qa/93728/how-many-types-of-operator-in-js-also-explain-the-example  
category: "web application"  
tags: ["javascript", "web application development", "web development"]  
reading_time: 3 minutes  

---

# How many types of operator in JS also explain the example?

How many types of [operator](https://www.mindstick.com/blog/271/wildcards-operators-in-sql) in JS also [explain](https://yourviews.mindstick.com/view/86025/content-created-for-humans-not-for-bots-explain-this-statement) with example

## Answers

### Answer by Ethan Karla

JavaScript operator are symbol that are used to perform operation on operant. There are following type pf operator. 1. Assignment operator 2. Arithmetic operator 3. Increment and decrement operator 4. Relational operator 5. Logical operator 6. Bitwise operator 7. Special Operator **Assignment Operator** The following operators are known as JavaScript assignment operators. Denote by the equal symbol (=) in js.

```
var name = ”MindStick”;
```

**Arithmetic Operator** Arithmetic operators are used to perform arithmetic operations on the operands. The following operators are known as JavaScript arithmetic operators (+, -, *, /) .

```
var a=45;var b=21;var res=a+b;console.log('45+21 = '+res);res=a-b;console.log('45-21 = '+res);res=a*b;console.log('45*21 = '+res);res=a/b; console.log('45/21 = '+res);
```

**Increment and decrement operator** This is used to increment value by one or decrement value by one.

```
var a=45;
var b=21;
a++;
console.log('a++ = '+a);
--a;
console.log('--a = '+a);
```

**Relational Operator** The JavaScript comparison operator compares the two operands. the relational operator are (==, ===, !=, <=, >=, <, >). Operator Description Example

```
var a=40;var b=50;var res= a==b;  console.log('a==b '+res)var res= a===b;  console.log('a==b '+res)var res= a!=b;  console.log('a==b '+res)var res= a>b;  console.log('a==b '+res)var res= a<b;  console.log('a==b '+res)var res= a<=b;  console.log('a==b '+res)
```

## Logical Operator

this is used to compare the more than one comparison. logical operators are (&&, ||, ! ).\

```
var a=40;var b=50;var res= a==b && a>b ;  console.log('a==b '+res)var res= a===b || a<b;  console.log('a==b '+res)var res= a!=b && a<=b;  console.log('a==b '+res)
```

\
**Bitwise Operator** The bitwise operators perform bitwise operations on operands. The bitwise operators are (&, |, ^, ~, <<,>>,>>> ).

```
var a=40;var b=50;var res= a&b ;  console.log('a==b '+res)var res= a|b;  console.log('a==b '+res)var res= a<<2;  console.log('a==b '+res)
```

\
**Special Operator** \
(?:) Conditional Operator returns value based on the condition. It is like if-else. , Comma Operator allows multiple expressions to be evaluated as single statement. delete Delete Operator deletes a property from the object. in In Operator checks if object has the given property instanceof checks if the object is an instance of given type new creates an instance (object) typeof checks the type of object. void it discards the expression's return value. yield checks what is returned in a generator by the generator's iterator.

```
var a=40;var b=50;var res= a<b ? 'A is less than b':'a is grater than b' ;  console.log(res)
```


---

Original Source: https://answers.mindstick.com/qa/93728/how-many-types-of-operator-in-js-also-explain-the-example

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
