-
-
Save kutyel/5cf1a6274cc31d50ba62dab592c795c5 to your computer and use it in GitHub Desktop.
Immutable-Functional-Array 🐑💨
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
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