September 9, 2000 - Trimming Decimal Numbers
![]() |
September 9, 2000 Trimming Decimal Numbers Tips: September 2000
Yehuda Shiran, Ph.D.
|
Math.ceil and Math.pow to format numbers the way we wanted to. IE5.5 fixes this problem with three new methods of the Number prototype object:
toFixed(fractionDigits)toExponential(fractionDigits)toPrecision(precision)
toFixed(fractionDigits) method formats a number with fractionDigits digits after the decimal place. If, for example,
x = 2.345678904557788;
and you call alert(x.toFixed(3)), you'll get 2.346 in IE5.5
.Learn more about formatting in Internet Explorer 5.5 in Column 59, IE 5.5: Formatting, URIs, and Stack Operations.


Find a programming school near you