我们可以通过JS数组的splice方法在执行的位置插入新的元素,非常简单
Click the button to add elements to the array. Try it
Click the button to add elements to the array.
上面的代码执行后输出如下结果:
Banana,Orange,Lemon,Kiwi,Apple,Mango
希望本文所述对大家的javascript程序设计有所帮助。