toFixed(2) - math round ?
Posted
by adrien334
on Stack Overflow
See other posts from Stack Overflow
or by adrien334
Published on 2010-05-18T20:47:46Z
Indexed on
2010/05/18
20:50 UTC
Read the original article
Hit count: 98
JavaScript
|rounding
Hi,
I would like to find a function that will return this kind of formatted values :
1.5555 => 1.55
1.5556 => 1.56
1.5554 => 1.55
1.5651 => 1.56
toFixed() and math round return this value :
1.5651.fixedTo(2) => 1.57
This will be usefull for money rounding.
© Stack Overflow or respective owner