Home Java Javascript-array JavaScript array valueOf
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

JavaScript array valueOf

Advertisement
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

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



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 10, 2008

Related Tutorials

Ask Questions?    Discuss: JavaScript array valueOf  

Post your Comment


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