Skip to content

Instantly share code, notes, and snippets.

@keropodium
Last active May 18, 2016 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save keropodium/db3c0b1790bbdaa8d8fe9c8961e7b53d to your computer and use it in GitHub Desktop.
Save keropodium/db3c0b1790bbdaa8d8fe9c8961e7b53d to your computer and use it in GitHub Desktop.
Immutable-Functional-Array 🐑💨
Array.prototype.push2 = function(x) {
return [].concat(this, x);
};
Array.prototype.pop2 = function() {
return this.slice(0, -1);
};
Array.prototype.unshift2 = function(x) {
return [].concat(x, this);
};
Array.prototype.shift2 = function() {
return this.slice(1);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment