Array.removeAt 函数
移除 Array 的指定索引处的元素。 静态函数,使用无需实例化。
语法
Array.removeAt(array, index);
参数
参数
说明
array
准备移除元素的数组
index
准备移除元素的索引.
备注
使用 removeAt 移除 Array 的指定索引处的元素. 元素索引值要比 index 参数小1.
如果 index 为负数, removeAt 函数从数组最后进行计数. 调用 removeAt 时使用的index 大于数组长度则无效.
下面示例给出如何调用removeAt.
JavaScript
var a = ['a', 'b', 'c', 'd', 'e'];Array.remove(a, 'c');// View the results: "a,b,d,e"document.write(a,"</p>");Array.removeAt(a, 2); // View the results: "a,b,e"document.write(a,"</p>");
请参见
Array 对象 Array 类型扩展 JScript Language Reference