var a = [1,2,3,4,5], b=a.length; for (var i=0; i<b; i++) { a.unshift(a.splice(1+i,1).shift()); } a.shift(); //a = [5,4,3,2,1];