Skip to content

Instantly share code, notes, and snippets.

@kutyel
Forked from keropodium/array.js
Last active June 7, 2016 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kutyel/5cf1a6274cc31d50ba62dab592c795c5 to your computer and use it in GitHub Desktop.
Save kutyel/5cf1a6274cc31d50ba62dab592c795c5 to your computer and use it in GitHub Desktop.
Immutable-Functional-Array 🐑💨
Array.prototype.push = function(x) {
return [].concat(this, x);
};
Array.prototype.pop = function() {
return this.slice(0, this.length-1);
};
Array.prototype.unshift = function(x) {
return [].concat(x, this);
};
Array.prototype.shift = function() {
return this.slice(1, this.length);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment