Skip to content

Instantly share code, notes, and snippets.

@AdrianSkar
Last active May 13, 2018 18:21
Show Gist options
  • Save AdrianSkar/603de5811816f6c78d16a96d713e2cc2 to your computer and use it in GitHub Desktop.
Save AdrianSkar/603de5811816f6c78d16a96d713e2cc2 to your computer and use it in GitHub Desktop.
[JS] fCC exercise: codepen.io/adrianskar/pen/yjEveL
function slasher(arr, howMany) {
return arr.slice(howMany);
/* With the splice() method:
arr.splice(0, howMany);
return arr;
*/
/* Using loops:
var newarr = [];
for (i=howMany; i<arr.length; i++){
newarr.push(arr[i]);
}
return newarr;
*/
}
slasher([1, 2, 3], 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment