Fastest way to move first element to the end of an Array Fastest way to move first element to the end of an Array arrays arrays

Fastest way to move first element to the end of an Array


var ary = [8,1,2,3,4,5,6,7];ary.push(ary.shift());  // results in [1, 2, 3, 4, 5, 6, 7, 8] 

jsFiddle example

var ary = [8,1,2,3,4,5,6,7];console.log("Before: " + ary);ary.push(ary.shift());  // results in [1, 2, 3, 4, 5, 6, 7, 8] console.log("After: " + ary);