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
with es6 syntax
function rotLeft(a, d) { const removed = a.splice(0,d); return [...a, ...removed]; }