📜  javascript数组推送中 - Javascript代码示例

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

代码示例1
var arr = [];
arr[0] = "Jani";
arr[1] = "Hege";
arr[2] = "Stale";
arr[3] = "Kai Jim";
arr[4] = "Borge";

console.log(arr.join()); // Jani,Hege,Stale,Kai Jim,Borge
arr.splice(2, 0, "Lene");
console.log(arr.join()); // Jani,Hege,Lene,Stale,Kai Jim,Borge
 Run code snippet