operator precedence in JavaScript

In every language, evaluation of an expression is done based on a predefined order of precedence which helps the language engine to determine which part of the expression will be evaluated first, which will second and so on.

Operator precedence in JavaScript

OperatorOperationOrder of PrecedenceOrder of Evaluation
++Increment1R -> L
Decrement1R -> L
Negation1R -> L
!NOT1R -> L
*, /, %Multiplication, division, modulus2L -> R
+, —Addition, subtraction3L -> R
+Concatenation3L -> R
<, <=Less than, less than, or equal4L -> R
>, >=Greater than, greater than, or equal4L -> R
==Equal5L -> R
!=Not equal5L -> R
===Identity5L -> R
!==Non-identity5L -> R
&&AND6L -> R
||OR6L -> R
?:Ternary7R -> L
=Assignment8R -> L
+=, -=, and so on.Arithmetic assignment8R -> L
Content Protection by DMCA.com
Please Share