Last active
December 20, 2015 04:39
-
-
Save iksnae/6072338 to your computer and use it in GitHub Desktop.
extending Array with a move( from, to ) function to reorder content in place
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.move = function (from, to) { | |
this.splice(to, 0, this.splice(from, 1)[0]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment