Easy Tutorial
❮ Jsref Getutcfullyear Dom Obj Tabledata ❯

JavaScript Number Object


Number Object

The Number object is a wrapper object allowing you to work with numerical values.

Number objects are created with new Number().

Syntax

Note: If a parameter cannot be converted into a number, it returns NaN (Not-a-Number).


Number Object Properties

Property Description
constructor Returns a reference to the Number function that created the object.
MAX_VALUE The largest number that can be represented.
MIN_VALUE The smallest number that can be represented.
NEGATIVE_INFINITY Represents negative infinity (returned on overflow).
NaN Represents a "Not-a-Number" value.
POSITIVE_INFINITY Represents positive infinity (returned on overflow).
prototype Allows you to add properties and methods to an object.

Number Object Methods

Method Description
isFinite Checks whether the provided value is a finite number.
isInteger Checks whether the provided value is an integer.
isNaN Checks whether the provided value is NaN.
isSafeInteger Checks whether the provided value is a safe integer.
toExponential(x) Converts a number into an exponential notation.
toFixed(x) Formats a number using fixed-point notation.
toLocaleString(locales, options) Returns a string with a language-sensitive representation of the number.
toPrecision(x) Formats a number to a specified length.
toString() Converts a number to a string, using a specified base.
valueOf() Returns the primitive value of a Number object.

ES6 New Number Properties

ES6 added the following properties to the Number object:

Example


ES6 New Number Methods

ES6 added the following methods to the Number object:

Number.isInteger() returns true if the argument is an integer.

Example

Number.isSafeInteger() checks whether the provided value is a "safe integer".

The safe integer range is between -(2^53 - 1) and 2^53 - 1, inclusive.

Example

❮ Jsref Getutcfullyear Dom Obj Tabledata ❯