Specifies the function that creates an object's prototype. Note that the value of this property is a reference to the function itself, not a string containing the function's name.
Object
All objects inherit a constructor property from their prototype:
o = new Object // or o = {}
o.constructor == Object
a = new Array // or a = []
a.constructor == Array
n = new Number(3)
n.constructor == NumberThe following example creates a prototype, Tree, and an object of that type, theTree. The example then displays the constructor property for the object theTree.
function Tree(name) {
this.name=name
}
theTree = new Tree("Redwood")
Console.Write("theTree.constructor is" + theTree.constructor)This example displays the following output:
theTree.constructor is function Tree(name) { this.name = name; }