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.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>                    

chevron_right


Output:
Before clicking on the Button :

After clicking on the Button:



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.