JavaScript Number Object Reference
The Number Object
The Number object is an object wrapper for primitive numeric values.
Syntax for creating a Number object:
var myNum=new Number(number);
|
Note: If the number parameter cannot be converted into a number, it
returns NaN.
Number Object Properties
FF: Firefox, IE: Internet Explorer
| Property |
Description |
FF |
IE |
| constructor |
Returns a reference to the Number function that created the object |
1 |
4 |
| MAX_VALUE |
Returns the largest possible value in JavaScript |
1 |
4 |
| MIN_VALUE |
Returns the smallest possible value in JavaScript |
1 |
4 |
| NaN |
Represents "Not-a-number" value |
1 |
4 |
| NEGATIVE_INFINITY |
Represents a value that is less than MIN_VALUE |
1 |
4 |
| POSITIVE_INFINITY |
Represents a value that is greater than MAX_VALUE |
1 |
4 |
| prototype |
Allows you to add properties and methods to the object |
1 |
4 |
Number Object Methods
| Method |
Description |
FF |
IE |
| toExponential() |
Converts the value of the object into an exponential
notation |
1 |
5.5 |
| toFixed() |
Formats a number to the specified number of decimals |
1 |
5.5 |
| toLocaleString() |
|
|
|
| toPrecision() |
Converts a number into a number with a specified number of
digits |
1 |
5.5 |
| toString() |
Converts the Number object into a string |
1 |
4 |
| valueOf() |
Returns the value of the Number object |
1 |
4 |
 |

|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|