Share via


toPrecision Method (JScript 5.6) 

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


numObj.toPrecision ([precision])

Arguments

  • numObj
    Required. A Number object.
  • precision
    Optional. Number of significant digits. Must be in the range 1 – 21, inclusive.

Remarks

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.

Requirements

Version 5.5

Applies To: Number Object (JScript 5.6)

See Also

Reference

toFixed Method (JScript 5.6)
toExponential Method (JScript 5.6)