Export (0) Print
Expand All

constructor Property (Number)

Specifies the function that creates a Number.


The required number is the name of a string.

The constructor property is a member of the prototype of every object that has a prototype. This includes all intrinsic JavaScript objects except the Global and Math objects. The constructor property contains a reference to the function that constructs instances of that particular object.

The following example illustrates the use of the constructor property.

var num = new Number();

if (num.constructor == Number)
    document.write("Object is a Number.");
    document.write("Object is not a Number.");

// Output:
// Object is a Number.

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

© 2015 Microsoft