Number

Number – Creates a wrapper object to allow you to work with numerical values.

Description

new Number([number number])

Parameters

Name Description Type Default Optional
number number Yes

Examples

Example #1 – number example

Three ways of creating a new number.

var num = new Number(1000); // Creates a new number object. console.log(num); // The Number object.
var num = 1000; // Create a new number primitive. console.log(num); // The number 1000.
var expression = new Date("January 1, 2011"); var num = Number(expression); // Used to convert a non-number to a number primitive. console.log(num); // The timestamp in milliseconds 1293836400000.

See also

External references