Array Functions - Description

Netscape 4 introduced a few new methods for the Array object which were not supported by Internet Explorer until the release of version 5.5. This script extends the Array object in Internet Explorer 4.x and 5.0 so that these methods are also available in that family of browsers. The script also allows the use of core Javascript 1.2 Array methods in browsers that support Javascript 1.1.

The functions provided by this script are:

See the API Documentation for details on each function's arguments and return value.

Script Engine / Document Object Model Required

Javascript 1.1 | JScript 2.0 | ECMAScript 1.0

Modification History

2000/09/11 v1.0

Posted.

2002/04/16 v1.0.1

Updated using function literals and a stronger test for existing native functionality.

2002/04/22 v1.0.2

Changed Array.push() so that it conforms with the ECMA standard and returns the new length of the array.

2002/06/24 v1.0.3

Bug fix.

2002/06/24 v1.0.4

Bug fix for Array.pop() to prevent errors when called on zero-length arrays (thanks Charles).

2002/12/10 v1.0.5

Changed script so that it didn't over-write existing native Array methods (thanks Martijn).

2004/01/20 v1.0.6

Array.pop() now returns undefined when called on an empty array as per the standard (thanks Antoine).

More about this script

Licensing

This script is released under a Creative Commons License.