Javascript - Array constructor Property

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

Description

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] }

You can use the constructor property to define if a variable is an array.

Syntax

array.constructor

Return

function Array() { [native code] }

Example

The constructor property returns an array's constructor function:

Demo

var myArray = ["B", "O", "A", "M"];
console.log( myArray.constructor);

Result