To copy part of an array:

It returns a new array filled with items from arr.

begin is 0-based index of the first item.

end is 0-based index of the last item

If only begin is given, slice copies everything until the end of array

If end is negative it becomes end = arr.length + end i.e. -1 would leave off last element of array, -2 last 2 elements etc.

if end is ≤ begin, returns an empty array.

https://codeeval.dev/gist/036ec15721848ba78806afd6f461c6e5