JS: formula ( 8 + 2 * 9 ), what is the first step of calculation? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

1st Oct 2019, 11:30 AM
Bernard Kemman
Bernard Kemman - avatar
3 Answers
0
That makes things clear, thanks Taste
1st Oct 2019, 11:36 AM
Bernard Kemman
Bernard Kemman - avatar
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).
1st Oct 2019, 1:29 PM
Muthumari Thangapandian
Muthumari Thangapandian - avatar