¡@

Home 

2014/10/16 ¤W¤È 12:01:47

jquery Programming Glossary: abbrnum

Is there a way to round numbers into a reader friendly format? (e.g. $1.1k)

http://stackoverflow.com/questions/2685911/is-there-a-way-to-round-numbers-into-a-reader-friendly-format-e-g-1-1k

question Here is a simple function to do it function abbrNum number decPlaces 2 decimal places 100 3 1000 etc decPlaces Math.pow.. abbrev i We are done... stop break return number Outputs abbrNum 12 1 12 abbrNum 0 2 0 abbrNum 1234 0 1k abbrNum 34567 2 34.57k.. done... stop break return number Outputs abbrNum 12 1 12 abbrNum 0 2 0 abbrNum 1234 0 1k abbrNum 34567 2 34.57k abbrNum 918395..

Is there a way to round numbers into a reader friendly format? (e.g. $1.1k)

http://stackoverflow.com/questions/2685911/is-there-a-way-to-round-numbers-into-a-reader-friendly-format-e-g-1-1k

javascript jquery rounding currency share improve this question Here is a simple function to do it function abbrNum number decPlaces 2 decimal places 100 3 1000 etc decPlaces Math.pow 10 decPlaces Enumerate number abbreviations var abbrev.. 1 number 1 i Add the letter for the abbreviation number abbrev i We are done... stop break return number Outputs abbrNum 12 1 12 abbrNum 0 2 0 abbrNum 1234 0 1k abbrNum 34567 2 34.57k abbrNum 918395 1 918.4k abbrNum 2134124 2 2.13m abbrNum 47475782130.. Add the letter for the abbreviation number abbrev i We are done... stop break return number Outputs abbrNum 12 1 12 abbrNum 0 2 0 abbrNum 1234 0 1k abbrNum 34567 2 34.57k abbrNum 918395 1 918.4k abbrNum 2134124 2 2.13m abbrNum 47475782130 2 47.48b..