The array to slice.
Optional
start: numberThe start position. A negative index will be treated as an offset from the end.
Optional
end: numberThe end position. A negative index will be treated as an offset from the end.
Returns the slice of array
.
5.6.0
var array = [1, 2, 3, 4]
slice(array, 2)
// => [3, 4]
Creates a slice of
array
fromstart
up to, but not including,end
.Note: This method is used instead of
Array#slice
to ensure dense arrays are returned.