Skip to content

Instantly share code, notes, and snippets.

@pavelpower
Last active December 25, 2015 23:19
Show Gist options
  • Save pavelpower/7055735 to your computer and use it in GitHub Desktop.
Save pavelpower/7055735 to your computer and use it in GitHub Desktop.
sample swap
function swap( obj1, obj2 ) {
var tmp = obj1;
obj1 = obj2;
obj2 = tmp;
};
Array.prototype.swap = function( i, j ) {
swap(this[i], this[j]);
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment