looking for some solutions? You are welcome.

SOLVED: unable to calculate the correct result of equation according to BODMAS in Javascript function

Sandy Sanap:

I have set the formula into the json file like (1000-3+25*75-23)/100 and i am reading it in javascript and passing to into function so by using eval Now i am getting the result 766.27 but here i want the result according to BODMAS method like

let result = eval("(1000-3+25*75-23)/100");
console.log(result) // 766.27
console.log("expected output") // 28.49

How i can use the BODMAS method for getting the expected result

Please help.



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent