向数组中添加元素
- push 在数组末尾添加
- splice 在数组任意指定位置添加
- unshift 在数组头部添加
- concat 在数组末尾添加(可添加元素或数组)
合并数组
- a.concat(b)
- a.push(...b)
- Array.prototype.push.apply(a,b)
- a.push.apply(a,b)
push、unshfit、splice在原数组中进行新增,均修改了原数组
concat 返回一新数组,但不改变原数组
向数组中添加元素
合并数组
push、unshfit、splice在原数组中进行新增,均修改了原数组
concat 返回一新数组,但不改变原数组