Javascript Array move(oldIdx, newIdx)
Array.prototype.move = function(oldIdx, newIdx){ if (newIdx > this.length) { newIdx = this.length;/* w ww .j a va 2s.co m*/ } this.splice(newIdx, 0, this.splice(oldIdx, 1)[0]); };