# JavaScript Operator Precedence - Operator Precedence in JavaScript

## JavaScript Operator Precedence

• The order in which operations are carried out in an arithmetic expression is known as operator precedence.
• Priority is given to division (/) and multiplication (*) above addition (+) and subtraction (-).

## Operator Precedence Values

Operator Description Example
( ) Expression Grouping (100 + 50) * 3
. Member Of person.name
[] Member Of person["name"]
?. Optional Chaining ES2020 x ?. y
( ) Function Call myFunction()
new New with Arguments new Date("June 5,2022")
new New without Arguments new Date()

## Increment Operators

Operator Description
++ Postfix Increment
-- Postfix Decrement
++ Prefix Decrement
-- Prefix Increment

## NOT Operators

Operator Description Example
! Logical NOT !(x==y)
~ Bitwise NOT ~x

## Unary Operators

Operator Description Example
+ Unary Plus +X
- Unary Minus -X
typeof Data Type typeof X
void Evaluate Void void(0)
delete Property Delete delete myCar.color

## Arithmetic Operators

Operator Description Example
** Exponentiation ES2016 10 ** 2
* Multiplication 10 * 5
/ Division 10 / 5
% Division Remainder 10 % 5
- Subtraction 10 - 5
+ Concatenation "John" + "Doe"

## Shift Operators

Operator Description Example
<< Shift Left x << 2
>> Shift Right (signed) x >> 2
>>> Shift Right (unsigned) x >>> 2

## Relational Operators

Operator Description Example
in Property in Object "PI" in Math
instanceof Instance of Object x instanceof Array

## Comparison Operators

Operator Description
< Less than x < y
<= Less than or equal x <= y
> Greater than x > y
>= Greater than or equal x >= Array
== Equal x == y
=== Strict equal x === y
!= Unequal x != y
!== Strict unequal x !== y

## Bitwise Operators

Operator Description Example
& Bitwise AND x & y
^ Bitwise XOR x ^ y
| Bitwise OR x | y

## Logical Operators

Operator Description Example
&& Logical AND x && y
|| Logical OR x || y
?? Nullish Coalescing ES2020 x ?? y

## Assignment Operators

Operator Description Example
= Simple Assignment x = y
: Colon Assignment x: 5
+= Addition Assignment x += y
-= Subtraction Assignment x -= y
*= Multiplication Assignment x *= y
**= Exponentiation Assignment x **= y
/= Division Assignment x /= y
%= Remainder Assignment x %= y
<<= Left Shift Assignment x <<= y
>>= Right Shift Assignment x >>= y
>>>= Unsigned Right Assignment x >>>= y
&= Bitwise AND Assignment x &= y
|= Bitwise OR Assignment x |= y
^= Bitwise XOR Assignment x ^= y
&&= Logical AND Assignment x &&= y
||= Logical OR Assignment x ||= y
=> Arrow x => y
yield Pause / Resume yield x
yield* Delegate yield* x