let arr1 = [1, 2, 3, 4, 5]
let arr2 = [1, 2, 3, 4 ,5]
// first to the last
arr1.push(arr1.shift()) // [2, 3, 4, 5, 1]
// last to the first
arr2.unshift(arr2.pop()) // [5, 1, 2, 3, 4]
function shiftElementToLastPlace(array){
let arr = [...array]
arr.push(arr.shift())
return arr
}
array.unshift().pop()
const newArr = [
...arr.slice(1),
arr[0]
];