javascript的数组之reverse()

reverse()方法将数组中所有元素的位置颠倒,修改原数组,并返回一个原数组的引用。

1 var array1 = ['one', 'two', 'three'];
2 var reversed = array1.reverse(); 
3 
4 console.log(array1);
5 // expected output: Array ['three', 'two', 'one']
6 
7 console.log(reversed);
8 // expected output: Array ['three', 'two', 'one']

参数:无

原文地址:https://www.cnblogs.com/huanqiuxuexiji/p/9168132.html