📅  最后修改于: 2022-03-11 15:02:48.902000             🧑  作者: Mango
const array1 = [1,2,3,4];
console.log('array1:', array1);
//"array1:" Array [1, 2, 3, 4]
const reversed = array1.reverse();
console.log('reversed:', reversed);
//"reversed:" Array [4, 3, 2, 1]
// Careful: reverse is destructive -- it changes the original array.
console.log('array1:', array1);
//"array1:" Array [4, 3, 2, 1]