0
What will be the execution order, if there are more than one parentheses in arithmetical operation in JavaScript?
Please analyse the code below and tell me what is the execution order in following arithmetical operation, shown in code. https://code.sololearn.com/W3SNcAj9g1vG/?ref=app
5 Réponses
+ 2
(4+4)/(4*4)*(2+2)
(4+4) = 8
(4*4) = 16
(2+2) = 4
8/16*4
(8/16)*4
(0.5)*4
2
+ 2
Yes. Paranthesis have higher precedence.
http://www-lia.deis.unibo.it/materiale/JS/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence.html
+ 1
Vadivelan Thanks:)
0
Vadivelan GReAt:)
0
Vadivelan on that note, if there are more than one parentheses, the execution order is from left to right, evaluating all the parentheses, then the execution order will shift to the operator level, ie. Operator having more precedence will execute first,
Sounds right?