Array.add Function

Adds an element to the end of an Array object. This function is static and is invoked without creating an instance of the object.

Array.add(array, item);

array

The array to add the item to.

item

The object to add to the array.

Use the add function to add an object of any type to the end of an array.

The following example shows how to add an element to the end of an array by using the add function.

var a = ['a', 'b', 'c', 'd'];
Array.add(a, 'e');
// View the results: "abcde"
alert(a.toString());
Show: