Have I missed a standard API call that removes trailing insignificant zeros from a number?
var x = 1.234000; // to become 1.234
var y = 1.234001; // stays 1.234001
Number.toFixed() and Number.toPrecision() are not quite what I’m looking for.
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.
If you convert it to a string it will not display any trailing zeros, which aren’t stored in the variable in the first place since it was created as a Number, not a String.