An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.
Syntax
numObj = new Number(value)
Parameters
numObj
Required. The variable name to which the Number object is assigned.
value
Required. The numeric value.
Remarks
JavaScript creates Number objects when a variable is set to a number value, for example var num = 255.336;. It is seldom necessary to create Number objects explicitly.
The Number object has its own properties and methods, in addition to the properties and methods inherited from Object. Numbers are converted into strings under certain circumstances, for example when a number is added or concatenated with a string, as well as by means of the toString method. For more information, see Addition Operator (+).
JavaScript has several number constants. For a complete list, see Number Constants.
Requirements
Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information.
Properties
The following table lists the properties of the Number object.
| Property | Description |
|---|---|
| constructor Property | Specifies the function that creates an object. |
| prototype Property | Returns a reference to the prototype for a class of objects. |
Functions
The following table lists the functions of the Number object.
| Function | Description |
|---|---|
| Number.isFinite Function | Returns a Boolean value that indicates whether a value is finite. |
| Number.isInteger Function | Returns a Boolean value that indicates whether a value is an integer. |
| Number.isNaN Function | Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). |
| Number.isSafeInteger | Returns a Boolean value that indicates whether a value can be safely represented in JavaScript. |
Methods
The following table lists the methods of the Number object.
| Method | Description |
|---|---|
| hasOwnProperty Method | Returns a Boolean value that indicates whether an object has a property with the specified name. |
| isPrototypeOf Method | Returns a Boolean value that indicates whether an object exists in another object's prototype hierarchy. |
| propertyIsEnumerable Method | Returns a Boolean value that indicates whether a specified property is part of an object and whether it is enumerable. |
| toExponential method | Returns a string that contains a number represented in exponential notation. |
| toFixed method | Returns a string that represents a number in fixed-point notation. |
| toLocaleString Method | Returns an object converted to a string based on the current locale. |
| toPrecision method | Returns a string that contains a number that is represented in either exponential or fixed-point notation and that has a specified number of digits. |
| toString Method | Returns a string representation of an object. |
| valueOf Method | Returns the primitive value of the specified object. |

