Number Methods
Published Aug 5, 2021Updated Oct 8, 2022
Contribute to Docs
The Number
object is used to represent numbers, like 3.14
, -10
, or 2022
, and it comes with a handful of methods that’s useful for handling with numbers.
JavaScript treats primitive values as objects when it’s executing methods and properties.
Number Methods
- .isFinite()
- Determines whether the passed value is a finite number.
- .isInteger()
- Determines whether the passed value is an integer.
- .isNaN()
- Determines whether the passed value is NaN.
- .parseFloat()
- Converts a string to a floating-point number.
- .parseInt()
- Converts a string into an integer.
- .toExponential()
- Converts a number to a string of its exponential form.
- .toFixed()
- Converts a number to a string of its fixed-point decimal form.
- .toLocaleString()
- Converts a date to a string of its language-sensitive form.
- .toPrecision()
- Converts a number to a string of its specified precision form.
- .toString()
- Converts a number to a string.
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.