SV: [thelist] JavaScript: trim function? [solved]

Tom Dell'Aringa pixelmech at yahoo.com
Fri Nov 14 13:55:50 CST 2003


--- Marcus Andersson <marcan at home.se> wrote:
> How about: 
>  
>   function trimNumber(number, digits) {
>     return Math.round(number * Math.pow(10, digits)) /
> ((Math.pow(10,
> digits) * 1.0));        
>   }

This is perfect actually, since I need to do this on a few numbers
not just one. (Not that I have a clue how it works..never was a math
guy.) Thanks Marcus and the thanks to others for the other
suggestions as well.

Tom

=====
http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: JavaScript Author / Every Friday!
http://www.thywordistruth.net/ :: Eternal Life

"I'll ho ho and ha ha you!" (Daffy Duck)


More information about the thelist mailing list