JavaScript Number Methods

garanews's avatar
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.

  • Front-end engineers work closely with designers to make websites beautiful, functional, and fast.
    • Includes 34 Courses
    • With Professional Certification
    • Beginner Friendly.
      115 hours
  • Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
    • Beginner Friendly.
      15 hours

Number Methods

.EPSILON
Defines the smallest positive difference between 1 and the next representable floating-point number in JavaScript.
.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.
.isSafeInteger()
Checks whether the passed value is a safe integer.
.MAX_SAFE_INTEGER
Represents the largest integer that JavaScript can use while maintaining exact precision.
.MAX_VALUE
Represents the largest numeric value that can be represented in JavaScript.
.MIN_SAFE_INTEGER
Represents the smallest safe integer in JavaScript, below which integer precision is not guaranteed.
.MIN_VALUE
Returns the smallest positive number representable in JavaScript, greater than 0.
.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.

All contributors

Contribute to Docs

Learn JavaScript on Codecademy

  • Front-end engineers work closely with designers to make websites beautiful, functional, and fast.
    • Includes 34 Courses
    • With Professional Certification
    • Beginner Friendly.
      115 hours
  • Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
    • Beginner Friendly.
      15 hours