+ 1

String to Math Calculation

I have a string "50+10-5*6" and I have to convert it to integer and do the calculation which will result in 30. Language: Javascript

8th Mar 2021, 4:52 AM
Khan ⭐
Khan ⭐ - avatar
2 odpowiedzi
+ 1
Then what should I use? Ryan Els
9th Mar 2021, 10:33 AM
Khan ⭐
Khan ⭐ - avatar
0
Khan ⭐ The use of eval is not good practice. It is known to produce unexpect results. A hackers dream function.
9th Mar 2021, 7:19 AM
Ryan Els
Ryan Els - avatar