The constructor property

The constructor property contains the value of the function code that constructed an array. It is mainly used for information or comparison.

function Array() {
[native code]
}

To access the property you use the array name followed by the dot operator and the constructor keyword.

arrayname.property

Of course you must replace arrayname and property with the actual names of the array and the property you want to use.

var StudentsClass = new Array(4);
document.write(StudentsClass.constructor);

The above code will output function Array() { [native code] } which is the constructor function of the array.

Leave a Reply