This page demistrates JavaScript Arrays as well as some of their usese. Arrays are a very useful tool when it comes to programming.
Property (arrayName.) |
Description |
length |
Is used to set or return the length of an Array. (physical size) |
prototype |
Lets you add properties and/or methods to an Array. |
Method (arrayName.) |
Description |
concat() |
Joins two or more Arrays together and returns a single array containing both. |
indexOf() |
Looks though the Array for a specific value, then returns the index position of that value. |
join() |
Places all elements of an Array into a String. |
lastIndexOf() |
Starts at the end of an Array searching for a specific value and returns the index position of that vlaue. |
pop() |
Deletes the last index of an Array and returns that value. |
push() |
Adds another value to the end of an Array and returns the new length of the Array. |
reverse() |
Reverses the order of an Array. |
shift() |
Removes the first element of an Array and returns it. |
slice() |
Takes a piece (slice) of an Array and returns it as new Array. |
sort() |
Puts the values in an Array in order. |
splice() |
Allows you to Add/Remove specific indexes from an Array. |
toString() |
Converts an Array into a String and returns the results |
unshift() |
Adds new infomation to the front of the Array and returns the new length of the Array. |
valueOf() |
Returns the primitive value (such as an integer) of an Array. |
|
Code |
Output |
|
|
|
|