Source @ github


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


new Number([number number])


Name Description Type Default Optional
number number Yes


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

  • Primitives

External references