Specifies the function that creates an object.
Syntaxobject.constructor
Examples
The following example illustrates the use of the constructor property.
function MyObj() {
this.number = 1;
}
var x = new String("Hi");
if (x.constructor == String)
document.write("Object is a String.");
document.write ("<br />");
var y = new MyObj;
if (y.constructor == MyObj)
document.write("Object constructor is MyObj.");
Remarks
The required object is the name of an object or function.
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.
See also Other articles AttributionsMicrosoft Developer Network: Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4