Returns a section of an array.
Required. An Array object.
Required. The beginning of the specified portion of arrayObj.
Optional. The end of the specified portion of arrayObj.
The slice method returns an Array object containing the specified portion of arrayObj.
The slice method copies up to, but not including, the element indicated by end. If start is negative, it is treated as length + start, where length is the length of the array. If end is negative, it is treated as length + end where length is the length of the array. If end is omitted, extraction continues to the end of arrayObj. If end occurs before start, no elements are copied to the new array.
The following examples show how to use the slice method. In the first example, all but the last element of myArray is copied into newArray. In the second example, only the last two elements of myArray are copied into newArray.
Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information.