edit

Array methods

Method Description w3schools.com
concat() Joins two or more arrays, and returns a copy of the joined arrays concat()
join() Joins all elements of an array into a string join()
pop() Removes the last element of an array, and returns that element pop()
push() Adds new elements to the end of an array, and returns the new length push()
reverse() Reverses the order of the elements in an array reverse()
shift() Removes the first element of an array, and returns that element shift()
unshift() Adds new elements to the beginning of an array, and returns the new length unshift()
slice() Selects a part of an array, and returns the new array slice()
  Sorts the elements of an array sort()
  Adds/Removes elements from an array splice()
  Converts an array to a string, and returns the result toString()
  Returns the primitive value of an array valueOf()

Concat three arrays:
<script type="text/javascript">
var parents = ["Jani", "Tove"];
var brothers = ["Stale", "Kai Jim", "Borge"];
var children = ["Cecilie", "Lone"];
var family = parents.concat(brothers, children);
document.write(family);
</script>

The output of the code above will be:

Jani,Tove,Stale,Kai Jim,Borge,Cecilie,Lone

Join the elements of an array into a string:

var fruits = ["Banana", "Orange", "Apple", "Mango"];
var energy = fruits.join();
document.write('the string energy = '+energy);

The output of the code above will be:

the string energy = Banana,Orange,Apple,Mango
  

Pop away the last element of an array:

var fruits = ["Banana", "Orange", "Apple", "Mango"];
var lastelement = fruits.pop();
document.write('"' + lastelement + '" from [' + fruits + ']');

The output of the code above will be:

"Mango"  from  [Banana,Orange,Apple]
  

Use push() to add one or more item(s):

var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi", "Lemon", "Pineapple");

The output of the code above will be:

Banana,Orange,Apple,Mango,Kiwi,Lemon,Pineapple

 a new item to an array:

var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");

The result of document.write( fruits ) will be:

Banana,Orange,Apple,Mango,Kiwi 

.shift() will remove the first item of an array:

var fruits = ["Banana", "Orange", "Apple", "Mango"];
var firstelement = fruits.shift();
document.write(firstelement + ' is first element and fruits = ' + fruits);

The output of the code above will be:

Banana is first element and fruits = Orange,Apple,Mango

 

.unshift(elements)   add elements into front of Array and return new lng.

SYNTAX = array.unshift(element1,element2, ..., elementX)
Parameter Description
element1,element2, ..., elementX Required. The element(s) to add to the beginning of the array

<script type="text/javascript">
Add new items to the beginning of an array:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.unshift("Lemon","Pineapple");

The result of document.write(fruits) will be:

Lemon,Pineapple,Banana,Orange,Apple,Mango

Slices of selected elements from an array:
SYNTAX = array.slice(start, end)

 
<script type="text/javascript">
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.write(fruits.slice(0,1) + "<br />");
document.write(  fruits.slice(1) + "<br />");
document.write( fruits.slice(-2) + "<br />");  //( 2 last! )
document.write(fruits);
</script>

The output of the code above will be:

Banana { by slice(0,1) }
Orange,Apple,Mango { by slice(1) }
Apple,Mango { by slice(-2) }
Banana,Orange,Apple,Mango  { by no slice }
 

Reverse the order of the elements in an array:

var fruits = ["Banana", "Orange", "Apple", "Mango"];
var fruits.reverse();

The result of fruits will be:

Mango,Apple,Orange,Banana