Last active
May 18, 2016 17:20
-
-
Save keropodium/db3c0b1790bbdaa8d8fe9c8961e7b53d 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.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