📜  javascript代码示例中的数组反转

📅  最后修改于: 2022-03-11 15:03:05.529000             🧑  作者: Mango

代码示例6
var arr = [1, 2, 3, 4, 5, 6, 7];
console.log (arr.reverse ());

for (i = 0; i < arr.length / 2; i++) {
  var temp = arr[i];
   temp =arr[arr.length - 1 - i];
  temp = temp;
}
console.log (arr);