I have a number with a comma, for example: 254,5. I need the 0 behind the ,5 so it stands like 254,50 instead..
I’m using this to get the number:
Math.floor(iAlt / 50) * 50;
How can i get the 0 behind the ,5?
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.
Try the
toFixed()method, which pads the decimal value to lengthnwith 0’s.A
Numberwill always remove trailing zeros, sotoFixedreturns aString.It’s important to note that
toFixedmust be called on a number. CallparseFloat()orparseInt()to convert a string to a number first, if required (not in this situation, but for future reference).