Heggy Castaneda
Jul 31, 2017 · 1 min read

Slasher Flick

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.

https://repl.it/JppB
function slasher(arr, howMany) {
// splice (startDeletei, #noOfthingstoDelete)
arr.splice(0, howMany);
// mutated arr returns
return arr
}
slasher([1, 2, 3], 2); // [3]
slasher([1, 2, 3], 0); // [1, 2, 3]
Heggy Castaneda

Written by

like to build things

More From Medium

Also tagged FCC

Also tagged FCC

De-Trump the Airwaves

Apr 2 · 4 min read

59

Also tagged JavaScript

Also tagged JavaScript

Build Your Own Map

51

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade