Created
July 16, 2009 16:39
-
-
Save jonrohan/148530 to your computer and use it in GitHub Desktop.
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
/* | |
* This function moves the nth member of the array to the end | |
*/ | |
Array.prototype.move2Back = function(n) { | |
this.push(this.splice(n,1).pop()); | |
return this; | |
} | |
var arr = ["Jani","Hege","Stale","Kai Jim","Borge","Tove"]; | |
console.log(arr.move2Back(3)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment