Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function removeTrailingZeros(value) {
- value = value.toString();
- if (value.indexOf('.') === -1) {
- return value;
- }
- while((value.slice(-1) === '0' || value.slice(-1) === '.') && value.indexOf('.') !== -1) {
- value = value.substr(0, value.length - 1);
- }
- return value;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement