+ 1
If * (multiplication) has higher precedence than /(Division) then why alert is not 1.
Alert(2Ă2Ă·2Ă2);
3 Answers
+ 4
in javascript (and most of languages) multiplication has same precedence than division, so left to right associativity occurs ^^
to do multiplication before division, use parenthesis ;P
+ 2
The expression is evaluated from left to right like this
2 * 2 -> (4)
(4) / 2 -> (2)
(2) * 2 -> (4)