Array#slice()

slice (beginIndex, endIndex) Arraypublic

Defined in packages/ember-runtime/lib/mixins/array.js:324

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
doc_EmberJs
2016-11-30 16:48:35
Comments
Leave a Comment

Please login to continue.