Removes the first occurrence of the specified item from an Array object. This function is static and can be invoked without creating an instance of the object.
var isRemoved = Array.remove(array, item);
The array to remove item from.
The object to remove from the array at the first occurrence.
true if the specified item exists as element in the array and was removed; otherwise, false.
Use the remove function to remove the first occurrence of a specified item from an array. The index value of items that remain in the array is decreased by one.
In Mozilla Firefox, calling the remove function with item set to undefined removes the first item with that value from the array. In other browsers, calling the function with item set to undefined has no effect.
The following example shows how to use the remove function to remove the first occurrence of an item from an array.
var a = ['a', 'b', 'c', 'd', 'e']; Array.remove(a, 'c'); // View the results: "a,b,d,e" alert(a); Array.removeAt(a, 2); // View the results: "a,b,e" alert(a);