const temp = arr[arr.length - 1]; arr[arr.length-1] = arr[0]; arr[0] = temp; console.log(arr); return arr; }