slice (beginIndex, endIndex) Array
public
Returns a new array that is a slice of the receiver. This implementation uses the observable array methods to retrieve the objects for the new slice.
let arr = ['red', 'green', 'blue']; arr.slice(0); // ['red', 'green', 'blue'] arr.slice(0, 2); // ['red', 'green'] arr.slice(1, 100); // ['green', 'blue']
Parameters:
-
beginIndex
Number
- (Optional) index to begin slicing from.
-
endIndex
Number
- (Optional) index to end the slice at (but not included).
Returns:
-
Array
- New array with specified slice
Please login to continue.