JS 反转数组

57 阅读1分钟

使用 reverse() 实现数组反转

const arr = [1, 2, 3];

console.log(arr); // [1, 2, 3]

arr.reverse();

console.log(arr); // [3, 2, 1]