1 /** 2 Removes a number of objects from the array 3 @param from The first object to remove 4 @param to (Optional) The last object to remove 5 */ 6 Array.prototype.remove = function(/**Number*/ from, /**Number*/ to) 7 { 8 var rest = this.slice((to || from) + 1 || this.length); 9 this.length = from < 0 ? this.length + from : from; 10 return this.push.apply(this, rest); 11 }; 12 13 /** 14 Removes a specific object from the array 15 @param object The object to remove 16 */ 17 Array.prototype.removeObject = function(object) 18 { 19 for (var i = 0; i < this.length; ++i) 20 { 21 if (this[i] === object) 22 { 23 this.remove(i); 24 break; 25 } 26 } 27 }