Version: v0.5.1 - Beta.  We welcome contributors & feedback.  THanks!

List.slice

slice(index, numItems = -1)

Description

Get a slice of items, starting at index.

If index is negative, it counts from the end of the List.

If numItems is -1, return all remaining items after index.

['a', 'b', 'c', 'd'].slice(1);
//= ['b', 'c', 'd']

['a', 'b', 'c', 'd'].slice(-2);
//= ['c', 'd']

['a', 'b', 'c', 'd'].slice(1, 2);
//= ['b', 'c']

See Also