Array.slice()
JavaScript 1.2+, JScript 3.0+ Nav4+, NES3+, IE 4+ Syntax
array.slice(start) array.slice(start, stop)
Description
The slice() method returns a new array that contains the elements of the original array starting at position start and ending at the element position before stop. If no stop position is specified, the new array will contain the elements of the original array, starting at the position stated in start through the end of the array. Table 6.14 lists the arguments and return values associated with this method.
Type | Item | Description |
---|---|---|
Arguments | start | The position in the array where the slice is to begin. Negative numbers can be used to count from the last ... |
Get Pure JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.