toPrecision()

Description :

This method works same as toFixed() method but this one starts from beginning of the number.

Syntax :

[number].toPrecision(value)

Input Parameters :

value - Optional
The precison to be considered from the start. Default is "0". If the number is more than the decimal length, then for the extra decimals "0" will be replaced
The value should be between 1-100 otherwise it throws error

Return Values :

Returns the converterd number as a string.


Test this method :

Test Result :   
Your Code :