JavaScript Array constructor Property


JavaScript array constructor property returns a reference to the array function that created the instance's prototype.

In JavaScript, the constructor property returns the constructor function for an object.

The return value is a reference to the function, not the name of the function:

For JavaScript arrays the constructor property returns function Array() { [native code] }

For JavaScript numbers the constructor property returns function Number() { [native code] }

For JavaScript strings the constructor property returns function String() { [native code] }

Example

The constructor property returns an array's constructor function:

var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.constructor;

Example -