JavaScript | Array constructor Property
The JavaScript Array constructor property is used to return the constructor function for an array object. It only returns the reference of the function and not returns the name of the function. So, In JavaScript arrays, it returns the function Array() { [native code] }.
Syntax:
array.constructor
Return value: It returns the function reference i.e. function Array() { [native code] }.
Example: This example illustrates the Array constructor property.
<!DOCTYPE html> <html> <head> <title> JavaScript Array constructor Property </title> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <h1>JavaScript | Array constructor Property</h1> <button onclick="myGeeks()"> Submit </button> <p id="sudo" style="font-size:20px;"></p> <!-- Script for array constructor --> <script> function myGeeks() { var name = ["sahil", "Manas", "Sagar", "Harshit"]; document.getElementById("sudo").innerHTML = name.constructor; } </script> </body> </html> |
Output:
Before clicking on the Button :

After clicking on the Button:

Recommended Posts:
- JavaScript | String constructor Property
- JavaScript | Date constructor Property
- JavaScript | Boolean constructor Property
- JavaScript | Number constructor Property
- JavaScript | Array prototype Constructor
- JavaScript | RegExp constructor
- JavaScript | Array length Property
- Sort array of objects by string property value in JavaScript
- Javascript | MouseEvent which Property
- JavaScript | lastIndex Property
- How to remove CSS property using JavaScript?
- JavaScript | Infinity Property
- JavaScript | global Property
- JavaScript | Cursor property
- JavaScript | multiline Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



