I was wondering what was the most efficient way to rotate a JavaScript array.
I came up with this solution, where a positive n rotates the array to the
n
var arr = ['a','b','c','d'] arr.slice(1,arr.length).concat(arr.slice(0,1)
var arr = ['a','b','c','d'] arr = arr.concat(arr.splice(0,1))