Home Java Javascript-array JavaScript array valueOf



JavaScript array valueOf
Posted on: November 10, 2008 at 12:00 AM
JavaScript array class have valueOf() method which returns the primitive value of the calling array object. This valueOf() method is called automatically by the JavaScript.

JavaScript array valueOf

     

JavaScript array class have valueOf() method which returns the primitive value of the calling array object. This valueOf() method is called automatically by the JavaScript. Syntax for the valueOf() method is given as below:

ArrayObject.valueOf()

In this example we have simply created an array of five elements in our JavaScript and we will be printing this array.

Here is the example code for the HTML file as given below:

 

 

 

<html>
<head>
<title>
JavaScript array valueOf() method example
</title>
<script type="text/javascript">
var arr = new Array(5);
arr[0]="Rose";
arr[1]="India";
arr[2]="Technologies";
arr[3]="Pvt";
arr[4]="Ltd";
document.write("<b>Array is </b>=>"+arr.valueOf()+"<br>");
</script>
</head>
<body bgcolor="#ddcdff">
<h2>
Implementation of valueOf() method on array object 
</h2>
</body>
</html>

Output of the example:

Download Sample Source Code

Related Tags for JavaScript array valueOf:
javajavascriptcarrayclassscriptobjectmethodipvaluereturnthiscallprimitivetoautomaticicalautoeitcallinglimitimincalasmcajclautomaticallyallmeobjwhichsurnatishallivomarayarvascrssriripthavatialujeicaicaprmiomo


More Tutorials from this section

Ask Questions?    Discuss: JavaScript array valueOf  

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.