Changes

Jump to: navigation, search

JavaScript Arrays

1,171 bytes added, 14:48, 15 May 2007
Accessing the Elements of a JavaScript Array
</pre>
 
== JavaScript Array Object Methods and Properties ==
 
Given that the JavaScript Array is an ''object'' it should not be surprising to learn that it contains ''properties'' and ''methods'' that allow you, as a JavaScript developer, to perform powerful tasks with the data in the array. The following table describes these methods and properties:
 
<table border="1" cellspacing="0">
<th>Method<th>Description</th>
<tr>
<td>concat()<td>Concatenates the elements passed into an array</td>
<tr>
<td>join()<td>Joins together all the elements in an array to produce a single string</td>
<tr>
<td>pop()<td>Deletes the last element added to the array - the opposite of push()</td>
<tr>
<td>push()<td>Adds a new element ot the end of the array - opposite of pop()</td>
<tr>
<td>reverse()<td>Reverses the order of the elements in the array</td>
<tr>
<td>shift()<td>Deletes the first element in the array and shifts the remaining elements down to fill the empty slot</td>
<tr>
<td>slice(''begin'', ''end'')<td>Returns a subsection of the array based on the begin and end index arguments. The ''end' argument is optional. If ommited the end of the array is assumed.</td>
 
 
</table>

Navigation menu