**What are the operators in JavaScript?**

Operators in JavaScript are a number of symbols that use the JavaScript Language to send instructions for performing certain types of operations, including certain mathematical, relational and logical. And JavaScript displays the results of that specific task as directed.

**How many types of Operators in JavaScript? And what?**

There are basically 11 types of Operators in JavaScript, below is the list of Operators:

- Arithmetic Operators: (+, -, *, /,%, **)
- Operator to save any value in Assignment Operators or JavaScript Variable: (=)
- Bitwise Operators or Binary Operators in JavaScript: – (&, |, ^, ~, <<, >>, << =, >> =, >>> =, & =, ^ =, | =)
- Comparison Operators or Operators to Compare Two or More Values: – (==,! =, ===,! ==, <,>, <=,> =)
- Incrementing / Decrementing Operators or 1 Increase or Decrease Operator: – (++, – -)
- Logical Operators or Operators for making decisions based on multiple conditions: – (&&, ||,!)
- String Operators or Operators for pairing with one or more string: – (+)
- Type operators to check whether a JavaScript variable is an instance of a class operator : – (not space after :)( instanceof) or typeof Operator to check whether it is a type of a variable or value
- Ternery Operator or if..else Operator.
- delete Operator: or delete operator is used to delete a specific property of an object.
- in Operator: Used to find the specific property of the object.

**What is Operand in JavaScript?**

All the variables or values on either side of the operator, in terms of JavaScript or any programming language, it is called Operand. Let us understand from the following example.

Here the two sides of the plus sign (+) are a and 5 respectively. These two operands and the plus sign (+) are the operators.

**What is Operator Precedence?**

Operator Precedence in JavaScript is a set of rules that determine which task will be performed first in JavaScript. Let us understand from the following example.

Explanation: The result of the above code will not be 18 but 16. The main reason for this is that among the two operators we use here, according to the Operator Precedence Rules, the multiplication (“*”) operator is given more priority than the addition (“+”) operator. Let’s look at another example below:

Explanation: Since the Parentheses “()” operator is given more priority than the Multiplication “*” operator in the above example, the work of addition between the parentheses is performed first. Then the function of multiplication “*” is performed.

**What is Operator Associativity?**

Operator Associativity is to determine which of the Operators of the same Precedence will be preferred in the absence of parentheses in JavaScript or any Programming Language.

**How many types of Operator Associativity in JavaScript? And what?**

There are two types of Operator Associativity in JavaScript:

- Right to Left (ie: Right Operator will be preferred.)
- Left to Right (ie: Left Operator will be preferred.)

Below is a list of JavaScript Operator Precedence. In the table below, Operator Precedence 1 priority will go down one by one. This list is very important to remember. Otherwise, if you try to solve various Mathematical and Programming problems, you may not get the desired results.

Table 1 operator precedence and associativity in JavaScript | |||

Operator | Operator Use | Operator Associativity | Operator Precedence |

() | Method/function call, grouping | Left to right | Highest — 1 |

[] | Array access | Left to right | 1 |

. | Object property access | Left to right | 1 |

++ | Increment | Right to left | 2 |

— | Decrement | Right to left | 2 |

– | Negation | Right to left | 2 |

! | Logical NOT | Right to left | 2 |

~ | Bitwise NOT | Right to left | 2 |

delete | Removes array value or object property | Right to left | 2 |

new | Creates an object | Right to left | 2 |

typeof | Returns data type | Right to left | 2 |

void | Specifies no value to return | Right to left | 2 |

/ | Division | Left to right | 3 |

* | Multiplication | Left to right | 3 |

% | Modulus | Left to right | 3 |

+ | Plus | Left to right | 4 |

+ | String Concatenation | Left to right | 4 |

– | Subtraction | Left to right | 4 |

>> | Bitwise right-shift | Left to right | 5 |

<< | Bitwise left-shift | Left to right | 5 |

>, >= | Greater than, greater than or equal to | Left to right | 6 |

<, <= | Less than, less than or equal to | Left to right | 6 |

== | Equality | Left to right | 7 |

!= | Inequality | Left to right | 7 |

=== | Identity operator — equal to (and same data type) | Left to right | 7 |

!== | Non-identity operator — not equal to (or don’t have the same data type) | Left to right | 7 |

& | Bitwise AND | Left to right | 8 |

^ | Bitwise XOR | Left to right | 9 |

| | Bitwise OR | Left to right | 10 |

&& | Logical AND | Left to right | 11 |

|| | Logical OR | Left to right | 12 |

?: | Conditional branch | Left to right | 13 |

= | Assignment | Right to left | 14 |

*=, /=, %=, +=,, -=, <<=, >>=, >>>=, &=, ^=, |= | Assignment according to the preceding operator | Right to left | 14 |

, | Multiple evaluation | Left to right | Lowest: 15 |