Home Java Javascript-array JavaScript Array Constructor
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

JavaScript Array Constructor

Advertisement
In this example you will study how to use the constructor property in JavaScript. The constructor property of JavaScript returns a reference to the array function that creates the object.

JavaScript Array Constructor

     

In this example you will study how to use the constructor property in JavaScript. The constructor property of JavaScript returns a reference to the array function that creates the object. You can see in the given example, we have create an instance of Array class. Then we have used the array.constructor property which returns the function name.

Here is the code:

<html>
<head>
<h2>JavaScript Array constructor Property</h2>
<script type="text/javascript">
var array = new Array("Rose", "India", "Technologies");
document.write("<b>The function of this object's instance is: </b>" + array.constructor+"<br>"); 
</script>
<body bgcolor="lightBlue"/>
</head>
<b>[The array.constructor property returns the function that created the object's instance.]</b>
</html>

Output will be displayed as:

Download Source Code

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 11, 2008

Ask Questions?    Discuss: JavaScript Array Constructor  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com