Exforsys.com
 
Home Tutorials JavaScript
 

JavaScript Array Object

 

JavaScript Array Object

Page 1 of 2

JavaScript Array Object

In this JavaScript tutorial, you will learn about JavaScript Array Object, its properties and methods.


Usage of the Array Object:

The Array object is used to store a set of values in a single variable name.


There are many operations involved with Array object:


  • Defining Array object
  • Adding Values to Array
  • Accessing Array
  • Editing or Modifying the Values of an Array

These topics have been addressed in previous sections on Arrays in JavaScript.


In this section, the properties and methods of Array Object in JavaScript will be outlined.


Properties of array Object:

length:

The length property of an array object returns the number of elements in an array.


General Syntax of length property of an array Object in JavaScript:



arrayObject.length 



For example:



<html>


  <body>
   <
script type="text/javascript">
     var exforsys = new Array(2)
     exforsys[0] = "Good"
     exforsys[1] = "Best"


     document.write("Old value of length:" + arr.length)
     document.write("<br />")
     arr.length=4
     document.write("Modified value of length:"+arr.length)
    </script>
  </
body>
</
html>




The output of the code above will be:



Old value of length: 2
Modified value of length: 4



index Property :

The index Property is a read-only property and this gives the index of the Array Object.


Next Page: JavaScript Array Object Methods


Read Next: JavaScript Array Object Methods – Part I



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2009 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape