const arr = [1, 2, 3, 4, 5];
function rotateLeft(arr){
//remove the first elemnt of array
let first = arr.shift();
//then add into the end of array
arr.push(first);
return arr;
}
function rotateRight(arr){
//remove the last elemnt of array
let last =arr.pop();
//then add into the first of array
arr.unshift(last)
return arr;
}
function rotLeft(a, d)
{
let rslt = a.slice(d).concat(a.slice(0,d));
return rslt
}