Array.slice()

Availability

Flash Player 5.

Usage

my_array.slice( [ start [ , end ] ] )

Parameters

start A number specifying the index of the starting point for the slice. If start is a negative number, the starting point begins at the end of the array, where -1 is the last element.

end A number specifying the index of the ending point for the slice. If you omit this parameter, the slice includes all elements from the start to the end of the array. If end is a negative number, the ending point is specified from the end of the array, where -1 is the last element.

Returns

An array.

Description

Method; extracts a slice or a substring of the array and returns it as a new array without modifying the original array. The returned array includes the start element and all elements up to, but not including, the end element.

If you don't pass any parameters, a duplicate of my_array is created.