[提示:你可先修改部分代码,再按运行]


js中array对象的splice方法
The splice() method is used to remove and add new elements to an array.
splice()可向数组删除并加入新的元素。

语法
arrayObject.splice(index,howmany,element1,.....,elementX)

index
Required. Specify where to add/remove elements. Must be a number
必选项。指定在哪个位置加入/删除元素,必须是数字。

howmany
Required Specify how many elements should be removed. Must be a number, but can be "0"
必选项。指定有多少元素应该被删除。必须是数字,可以是"0"

element1
Optional. Specify a new element to add to the array
可选。指定要加入到数组中的新元素

elementX
Optional. Several elements can be added
可选。可以加入多个元素