Javascript Array constructor

The constructor property returns the constructor function for the array.


let languages = ["JavaScript", "Java", "Python"];

let constructor = languages.constructor;

// Output:
// [Function: Array]

constructor Syntax

The syntax to access the constructor property is:


Here, arr is an array.

constructor Parameters

The constructor is a property in JavaScript, so it doesn't take any parameters.

constructor Return Value

  • Returns the constructor function for the array.

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

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

Example : Using constructor property

let array = [1, 2, 3, 4, 5];

let constructor = array.constructor;



[Function: Array]

Also Read:

Did you find this article helpful?