|
March 17, 2000 IE5.5's Number Formatting Tips: March 2000
Yehuda Shiran, Ph.D.
|
|
Until IE5.5, formatting numbers was a real challenge. We all used high mathematical functions such as 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:
The
and you call alert(x.toFixed(4)), you'll get 1234.5679 in IE5.5.
The toExponential(fractionDigits) method formats a number with
and you call alert(x.toExponential(2)), you'll get 1.23e+3 in IE5.5.
The
and you call alert(x.toPrecision(2)), you'll get 1.2e+3 in IE5.5 .
When you call Exprience some of these functions by yourself in Column 59, IE 5.5: Formatting, URIs, and Stack Operations.
People who read this tip also read these tips: Look for similar tips by subject: |