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.

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

Advertisements

 

We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.

Share on Google+Share on Google+

JavaScript Array Constructor

Posted on: November 11, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: JavaScript Array Constructor  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads