JavaScript Objects The Number Object- toPrecision() - Javascript Objects

What is JavaScript Number - toPrecision()?

toPrecision() method - returns a string that represents the number object to the specified precision.


Its syntax is as follows −

Parameter Details:

precision − An integer specifying the number of significant digits.

Return Value:

Returns a string that represents a Number object in fixed-point or exponential notation rounded toprecision significant digits.


Observe the following example -


JavaScript Number Object toPrecision()

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Javascript Objects Topics