📌  相关文章
📜  替换数组中的特定值 - Javascript 代码示例

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

代码示例3
var fruits = [“banana”, “apple”, “orange”, “watermelon”, “apple”, “orange”, “grape”, “apple”];
fruits.splice(0, 2, “potato”, “tomato”);
console.log(fruits); // returns [“potato”, “tomato”, “orange”, “watermelon”, “apple”, “orange”, “grape”, “apple”]