Skip to content

Instantly share code, notes, and snippets.

@luijar
Created September 26, 2015 21:51
Show Gist options
  • Save luijar/6b233fbcbf9bd5d47f40 to your computer and use it in GitHub Desktop.
Save luijar/6b233fbcbf9bd5d47f40 to your computer and use it in GitHub Desktop.
Remove head
// 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