js 数组添加元素 删除元素 的方法

// 往数组结尾添加元素
arr.push( 元素 );  


// 删除数组里索引是 index 的那个元素。第二个参数 1 表示删除一个元素
arr.splice( index, 1 ); 

猜你喜欢

转载自blog.csdn.net/beguile/article/details/86607859