SOURCE

// 数组反转
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]))
console 命令行工具 X clear

                    
>
console