Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript change long digit ot k,m

function nFormatter(num) {
     if (num >= 1000000000) {
        return (num / 1000000000).toFixed(1).replace(/.0$/, '') + 'G';
     }
     if (num >= 1000000) {
        return (num / 1000000).toFixed(1).replace(/.0$/, '') + 'M';
     }
     if (num >= 1000) {
        return (num / 1000).toFixed(1).replace(/.0$/, '') + 'K';
     }
     return num;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #change #long #digit #ot
ADD COMMENT
Topic
Name
3+6 =