JavaScript Number method: toPrecision()
[this page | pdf | back links]
The toPrecision() method (when applied to JavaScript
numbers) returns
a string representing the number with a fixed number of significant digits.
It
has the following syntax with the following parameters:
number.toPrecision(n)
|
Parameter
|
Required / Optional
|
Description
|
|
n
|
Optional
|
(default is 0), Integer indicating number of
digits. If omitted then returns a string representation of the entire number
(without any formatting)
|
NAVIGATION LINKS
Contents | Prev | Next | JavaScript Numbers and Math