• JavaScript Video Tutorials

JavaScript - Array constructor Property



Description

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

Syntax

Its syntax is as follows −

array.constructor

Return Value

Returns the function that created this object's instance.

Example

Try the following example.

<html>
   <head>
      <title>JavaScript Array constructor Property</title>
   </head>
   
   <body>
   
      <script type = "text/javascript">
        var arr = new Array( 10, 20, 30 );
        document.write("arr.constructor is:" + arr.constructor); 
      </script>
      
   </body>
</html>

Output

arr.constructor is: function Array() { [native code] } 
javascript_arrays_object.htm
Advertisements