关于数组的合并arr.push() arr.push.apply()

arr=[1,2];
arr1=[3,4];
arr3=arr.push(arr1);
console.log(arr);
console.log(arr1);
console.log(arr3);

result:

  [1,2,[3,4]]

  [3,4]

  3

arr=[1,2];
arr1=[3,4];
arr3=arr.push.apply(arr,arr1);
console.log(arr);
console.log(arr1);
console.log(arr3)

result:

  [1,2,3,4]

  [3,4]

  4

posted @ 2020-03-09 20:31  一颗糊涂淡  阅读(1310)  评论(0编辑  收藏  举报