Skip to content

Slasher Flick

Islam Ibakaev edited this page Apr 26, 2016 · 1 revision

Details

Return the remaining elements of an array after chopping off n elements from the head.

The head means the beginning of the array, or the zeroth index.

Elegant Solution

function slasher(arr, howMany) {
  arr.splice(0, howMany);
  return arr;
}

slasher([1, 2, 3], 2); // returns [3]
Clone this wiki locally