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