1.reverse()
let arr=[10,20,30,40,50] console.log(arr.reverse()); //使用数组反转方法来进行反转
2.使用for循环进行反转
let arr = [10, 20, 30, 40, 50] for (let i = arr.length-1; i >=0; i--) { console.log(arr[i]); }
1.使用unshift()方法
let arr = [10, 20, 30, 40, 50] let arr2 = [] arr.forEach(item =>arr2.unshift(item)) console.log(arr2)