Last active
May 13, 2018 18:21
-
-
Save AdrianSkar/603de5811816f6c78d16a96d713e2cc2 to your computer and use it in GitHub Desktop.
[JS] fCC exercise: codepen.io/adrianskar/pen/yjEveL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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