1
How to return the number of decimals after the comma in c or javascript;
Example:
To the entrance
2.254
The exit would be
3
1
How to return the number of decimals after the comma in c or javascript;
Example:
To the entrance
2.254
The exit would be
3
Browser other questions tagged javascript
You are not signed in. Login or sign up in order to post.
You want to know the number or numbers after the comma?
– Sergio
Put your number in a variable, pass it to string, split the string at the point and then count the characters:
var a = 1.2345; a.toString().split('.')[1].length
– lfarroco
What you seek is not rounding?
– Leonardo Coelho
Is that something you’re looking for? https://jsfiddle.net/cpjw12ub/
– Sergio