Add or remove an item
array.splice(index, howmany, item1, ....., itemX)
// index: required, where to start;
// howmany: optional, how many items to be removed, 0 means add;
// item1: optional, item to be added.
Example 1:
// remove
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.splice(2, 1);
alert(fruits);
// ["Banana", "Orange", "Mango"]
// add
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.splice(2, 0, "Lemon", "Kiwi");
alert(fruits);
// ["Banana", "Orange", "Lemon", "Kiwi", "Apple", "Mango"]
// remove and add
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.splice(2, 1, "Lemon", "Kiwi");
alert(fruits);
// ["Banana", "Orange", "Lemon", "Kiwi", "Mango"]