–JS File
function solution(A, K) {
// write your code in JavaScript (Node.js 8.9.4)
var storeArray = A;
for(var i=0; i<K; i++){
var new1 = storeArray.splice(0, storeArray.length-1);
var new2 = storeArray.splice(storeArray.length-1, storeArray.length);
storeArray = new2.concat(new1);
}
return storeArray;
}