English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
JavaScript Global Properties/Function
The function of the Number() is to convert the given object parameter to a number.
Returns NaN if the value cannot be converted to a number.
If the parameter is a Date object, the Number() function returns the milliseconds since UTC 1970 years1Month1Milliseconds since the start of the day at midnight.
Number(object)
Number(true); // 1 Number(false);// 0 Number('100');// 100 Number('2 + 6); // NaN Number(new Date());Test and see‹/›
All browsers fully support the Number() function:
Function | |||||
Number() | Is | Is | Is | Is | Is |
Parameter | Description |
---|---|
object | A JavaScript object. Returns 0 if no arguments are provided. |
Return value: | Returns the numeric value corresponding to different object values:
|
---|---|
JavaScript Version: | ECMAScript 1 |