JavaScript Number Reference

This chapter contains a brief overview of the properties and method of the global Number object.

The JavaScript Number Object

The JavaScript Number object acts as a wrapper for primitive numeric values. JavaScript has only one kind of number data type and it doesn't distinguish between integers and floating-point values.

To learn more about Number, please check out the JavaScript numbers chapter.

Number Properties

The following table lists the standard properties of the Number object.

Property Description
MIN_SAFE_INTEGER Represents the maximum safe integer in JavaScript (253 - 1).
MAX_VALUE Returns the largest numeric value representable in JavaScript, approximately 1.79E+308. Values larger than MAX_VALUE are represented as Infinity.
MIN_SAFE_INTEGER Represents the minimum safe integer in JavaScript (-(253 - 1)).
MIN_VALUE Returns the smallest positive numeric value representable in JavaScript, approximately 5e-324. It is closest to 0, not the most negative number. Values smaller than MIN_VALUE are converted to 0.
NEGATIVE_INFINITY Represents the negative infinity value.
NaN Represents "Not-A-Number" value.
POSITIVE_INFINITY Represents the infinity value.
prototype Allows you to add new properties and methods to a Number object.

Note: Every object in JavaScript has a constructor property that refers to the constructor function that was used to create the instance of that object.

Number Methods

The following table lists the standard methods of the Number object.

Method Description
isFinite() Checks whether the passed value is a finite number.
isInteger() Checks whether the passed value is an integer.
isNaN() Checks whether the passed value is NaN and its type is Number.
isSafeInteger() Checks whether a value is a safe integer.
toExponential() Converts a number to exponential notation.
toFixed() Formats a number using fixed-point notation.
toPrecision() Returns a string representing the number to the specified precision.
toString() Converts a number to a string.
valueOf() Returns the primitive value of a Number object.

Your Feedback:

We would love to hear from you, please drop us a line.