.toPrecision()

Term side of the Card
Topic: Number
Unit title: .toPrecision()
Categories: Method
Explanation side of the Card

Explanation: The method that formats a number to a specified length (number of significant digits) and returns it as a string. It can round the number if necessary to fit the specified precision.

Browser compatibility:
  • The chrome browser supports this feature starting from version 1
  • The edge browser supports this feature starting from version 12
  • The firefox browser supports this feature starting from version 1
  • The safari browser supports this feature starting from version 2
Availability: