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);

Arguments

  • array
    The array to add the item to.

  • item
    The object to add to the array.

Remarks

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

Example

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());

See Also

Reference

Array Object

Array Type Extensions

Other Resources

Language Reference