0
Why the code returns this.
var a = 5; a = a - a % 2 console.log(a) //4 Why this code returns 6 instead of 0
2 Answers
+ 3
when operators have same precedence, computation is done from left to right... but when one has higher precedence, it will be computed before ^^
to be aware of different operator precedence in JS, you could refer to this link:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence
0
visph thanks again, you are genius