📜  插入具有该索引上存在的值的特定数组索引 - Javascript代码示例

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

代码示例1
var colors=["red","blue"];
var index=1;

//insert "white" at index 1
colors.splice(index, 0, "white");   //colors =  ["red", "white", "blue"]