+ 1
JS: formula ( 8 + 2 * 9 ), what is the first step of calculation?
I just started studying JS, and something is not quite clear to me. If you have the formula ( 8 + 2 * 9 ), what is the first step of calculation? 2*9 or 8+2? In mathematics you start with multiplying. Or is the first step 8+2?
3 Respuestas
+ 5
its pretty much the same as math
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence
0
That makes things clear, thanks Taste
0
Precedence of the operator "*" is higher than "+".
So,It first do multiplication,and then addition.
The answer is 26. (2*9=18,18+8=26).