|
October 17, 2001 Setting the Number of Decimal Digits Tips: October 2001
Yehuda Shiran, Ph.D.
|
|
The toFixed(fractionDigits) method formats a number with fractionDigits digits after the decimal place. Suppose:
and you call alert(x.toFixed(4)), you'll get 1234.5679 in IE5.5 and up.
Another way to format a floating number is to multiply it by the proper power of
People who read this tip also read these tips: Look for similar tips by subject: |
| ||||||||||||||||||||