What’s wrong with this code?
var result = 985.toFixed(2);
And the fix is:
var result = (985).toFixed(2);
I still want to know the reason. 🙂
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In the first example, the Javascript interpreter interprets the dot as a decimal point, because it’s coming after a number.
Putting brackets around the number gets around this limitation.