Home Java Javascript-array JavaScript Array Constructor



JavaScript Array Constructor
Posted on: November 11, 2008 at 12:00 AM
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

Related Tags for JavaScript Array Constructor:
javajavascriptcarrayclassfunctionscriptconstructorreferenceobjectfuniostructpropertysedconstipnamereturninstancethiscreateexamplestudyunctoexamrefeilcanusepeceinasstamtrcajclesfuncmehowobjprotorreferxawhichxampsurnctoreeatishallivmplproperrayeaarconsstrrtropevascrssririprenthavsthatctofejepleplpropprono


More Tutorials from this section

Ask Questions?    Discuss: JavaScript Array Constructor  

Post your Comment


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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.