Array Power, Part I - DHTML Lab | 2
Array Power, Part I
The table on this page lists the Array methods supported by each browser, and which of these are included in the ECMAScript Version 3 standard.
More information can be found on these sites:
Microsoft: JScript Language Reference
ECMAScript: ECMAScript Language Specification
|concat||Joins two arrays and returns a new array.|
|join||Joins all elements of an array into a string.|
|pop||Removes the last element from an array and returns that element.|
|push||Adds one or more elements to the end of an array and returns the new length of the array.|
|reverse||Transposes the elements of an array: the first array element becomes the last and the last becomes the first.|
|shift||Removes the first element from an array and returns that element|
|slice||Extracts a section of an array and returns a new array.|
|splice||Adds and/or removes elements from an array.|
|sort||Sorts the elements of an array.|
|toSource||Returns an array literal representing the specified array; can be used to create a new array.|
|toString||Returns a string representing the array and its elements.|
|unshift||Adds one or more elements to the front of an array and returns the new length of the array.|
|valueOf||Returns the primitive value of the array.|
In order for Explorer to conform to ECMAScript version 3, it needs five new methods:
pop(), push(), shift(), splice() and unshift()
Our task is to create these methods for Explorer using the prototype property and the built-in methods available to us.
We'll start with unshift().
Produced by Peter Belesis andAll Rights Reserved. Legal Notices.
Created: April 26, 2000
Revised: April 26, 2000