First of all, Statement A & Statement B will generate different results.
In Statement A
, you are inserting an array (["Lemon", "Kiwi"]
) as an array element at position 2 while removing 0 items. So, you are inserting a string array in another string array at position 2.
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.splice(2,0,["Lemon", "Kiwi"]);
console.log(fruits);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…