Skip to content

Instantly share code, notes, and snippets.

@ceaksan
Created September 18, 2015 14:09
Show Gist options
  • Save ceaksan/862bdbf87ce7e25a998d to your computer and use it in GitHub Desktop.
Save ceaksan/862bdbf87ce7e25a998d to your computer and use it in GitHub Desktop.
function slasher(arr, howMany) {
if (howMany >= arr.length) return null;
else if (howMany === 0) return arr;
else arr.splice (0, howMany); return arr;
}
slasher([1, 2, 3], 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment