Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

toPrecision Method 

Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits.


function toPrecision ( [precision : Number] ) : String

precision

Optional. Number of significant digits. Must be in the range 1 – 21, inclusive.

For numbers in exponential notation, precision - 1 digits are returned after the decimal point. For numbers in fixed notation, precision significant digits are returned.

If precision is not supplied or is undefined, the toString method is called instead.

Community Additions

ADD
Show:
© 2015 Microsoft