js_数组反转

数组反转      
1  var arry = ['张飞', '刘备', '关羽', '曹操']
2       var newArry = []
3       // for (var i = arry.length - 1; i >= 0; i--) {
4       // newArry[newArry.length] = arry[i]
5       // }
6       for (var i = 0; i < arry.length; i++) {
7         newArry[newArry.length] = arry[arry.length - i - 1]
8       }
9       console.log(newArry)

 

上一篇:UDP ------ UDP IPPROTO_UDPLITE 参数


下一篇:A - Wireless Network POJ - 2236