SHARE
TWEET

Untitled

a guest Oct 18th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function removeTrailingZeros(value) {
  2.   value = value.toString();
  3.  
  4.   if (value.indexOf('.') === -1) {
  5.       return value;
  6.   }
  7.  
  8.   while((value.slice(-1) === '0' || value.slice(-1) === '.') && value.indexOf('.') !== -1) {
  9.       value = value.substr(0, value.length - 1);
  10.   }
  11.   return value;
  12. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top