Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,101 members, 7,953,351 topics. Date: Thursday, 19 September 2024 at 02:53 PM |
Nairaland Forum / Science/Technology / Programming / Help On Javascript Console (399 Views)
Is It Necessary To Read A Book On Javascript? / Companies Working On Javascript Framework / Good Book On Javascript (2) (3) (4)
Help On Javascript Console by stevedeey(m): 4:42pm On Nov 22, 2020 |
Following BODMAS rule, 9 - 4 + 1 should give me 4. I run same on Javascript console it returned 6 instead. Help, What am I missing? |
Re: Help On Javascript Console by 404Dev: 6:16pm On Nov 22, 2020 |
stevedeey:bodmas is for mathematics. In javascript and programming operations move from left to right so its is 9-4 = 5 then +1 which is 6 |
Re: Help On Javascript Console by stanliwise(m): 6:43pm On Nov 22, 2020 |
stevedeey:9-4+1 does not give you 4 mathematically It only gives you 6. Except you mean 9 - (4 + 1) The verbose version of your calculation would be +9-4+1 This means all numbers carry a sign at their front. So it would be wrong for you to assume 4 + 1 instead of -4 +1 which is more accurate 7 Likes 1 Share |
Re: Help On Javascript Console by stevedeey(m): 7:08pm On Nov 22, 2020 |
Thanks so much @contributors. I realised to get 4, I'd need to introduce brackets 3 Likes 1 Share |
Re: Help On Javascript Console by nagalee(m): 3:32am On Nov 23, 2020 |
stevedeey:using Bodmas, the result will still be 6 . It is -4 + 1 = -3. Then 9 - 3 = 6. Not 4 + 1 = 5 then 9 -5 = 4. So you applied bodmas wrongly. 1 Like |
Re: Help On Javascript Console by cixak95212: 10:18am On Nov 23, 2020 |
404Dev: 2 Likes |
(1) (Reply)
!!! / Asides Admob, What Other Mobile Ad Network Is Best For My App / As A Computer Science Student,where Can I Get This?
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 9 |