DavidSzczesniak
10/28/2017 - 10:55 PM

Simple use of .splice

Return remaining elements of an array after chopping off -secondary argument- number of elements from the head.

function slasher(arr, howMany) {
  // Delete whatever index is secondary argument, starting from the head of the array
  arr.splice(0, howMany);
  
  return arr;
}

// Example call
slasher([1, 2, 3], 2);