Created
September 26, 2015 21:51
-
-
Save luijar/6b233fbcbf9bd5d47f40 to your computer and use it in GitHub Desktop.
Remove head
This file contains 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
// Remove the first element | |
var people = [ | |
ana, luis, carlos, nestor, maria | |
]; | |
function head(arr) { | |
return arr.shift(); | |
} | |
head(people); // side effect (changed the content of the original array - people) | |
console.log(firstnames(people)); //-> ["LUIS", "CARLOS", "NESTOR", "MARIA"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment