js把一个数组插入到另一个数组的指定位置
var arr1 = ['a', 'b', 'c']; var arr2 = ['1', '2', '3']; // 把arr2 变成一个适合splice的数组(包含splice前2个参数的数组) arr2.unshift(2, 0); console.log(arr2); //[2, 0, "1", "2", "3"] Array.prototype.splice.apply(arr1, arr2); console.log(arr1); //["a", "b", "1", "2", "3", "c"]