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.
.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-sensitivie form.
.toPrecision()
Converts a number to a string of its specified precision form.
.toString()
Converts a number to a string.

All contributors

Looking to contribute?

Learn JavaScript on Codecademy