读书人

JavaScript数组增添remove方法

发布时间: 2012-10-25 10:58:57 作者: rapoo

JavaScript数组添加remove方法

Array.prototype.remove = function(from, to) {         var rest = this.slice((to || from) + 1 || this.length);         this.length = from < 0 ? this.length + from : from;           return this.push.apply(this, rest);   };

读书人网 >JavaScript

热点推荐