/

HTML / CSS / JavaScript Tutorial

JavaScript Global method: Number()

[this page | pdf | back links]

The JavaScript Global Number() method converts an object to a number representing the value of the object (if this is possible) or returns NaN if such a conversion is not possible. If the parameter is a Date object then it returns the number of milliseconds since midnight 1 Jan 1970 (UTC).

 

It has the following syntax with the following parameters:

 

Number(x)

 

Parameter

Required / Optional

Description

x

Optional

Input parameter. If missing then returns 0.

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile