js中数组插入、删除元素操作的方法

上传:guoqinggai22423 浏览: 30 推荐: 0 文件:PDF 大小:36.07KB 上传时间:2020-12-13 06:11:00 版权申诉
实例如下: /* * 删除数组元素:Array.removeArr(index) */ Array.prototype.removeArr = function (index) { if (isNaN(index) || index>= this.length) { return false; } this.splice(index, 1); } /* * 插入数组元素:Array.insertArr(dx) */ Array.prototype.insertArr = function (index, item) { this.spl
上传资源
用户评论