JSFiddle - React, Tailwind, and code Playground
JavaScript
function rotateArray(arr, rotate) {
var initalValue = arr.unshift();
arr.pop();
arr.shift(initalValue);
console.log(arr);
}
rotateArray([1,2,3,4,5], 4);
function rotateArray(arr, rotate) {
var initalValue = arr.unshift();
arr.pop();
arr.shift(initalValue);
console.log(arr);
}
rotateArray([1,2,3,4,5], 4);