// 数组反转 function reverseArray(arr) { let start = 0, end = arr.length - 1; while (start < end) { const temp = arr[start]; arr[start++] = arr[end]; arr[end--] = temp; } return arr; } console.log(reverseArray([1, 2, 3, 4, 5]))