0 out of 1 rated this helpful - Rate this topic

constructor Property (String)

JavaScript - Internet Explorer 10

Specifies the function that creates a string.

string.constructor

The required string 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 x = new String();

if (x.constructor == String)
    document.write("Object is a String.");
else
    document.write("Object is not a String.");

// Output:
// Object is a String.

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. Also supported in Windows Store apps. See Version Information.

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.