Javascript solution in 3 lines

interview-questions
Tags: #<Tag:0x00007f242ce6c650>

#1

rotateArray : function(A, B) {
B = B > A.length ? B % A.length : B;
const rotatedElements = […A.splice(0, B)];
A = […A, …rotatedElements];
return A;
}