Here you can find the source of delete_at(from, to)
Array.prototype.delete_at = 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); } Array.prototype.delete_if = function(matcher){ for(var i = 0; i < this.length; i++){ if(matcher(this[i])) { this.delete_at(i)//from w w w . jav a 2s . c om i-- } } } Array.prototype.delete_unless = function(matcher){ this.delete_if(function(item){ return !matcher(item) }) }
Array.prototype.delete = function() { var arr = this; var todel = arguments[0]; if(todel && todel instanceof Array) { var arraux = []; for(var i=0; i<todel.length;i++) { arr.some(function(el, j){ if(el == todel[i]){ arraux.push(j+''); ...
'use strict'; Array.prototype.delete = function (index) { delete this[index]; this.splice(index, 1); return this; };
Array.prototype.deleteAll = function(){ var arr = this; arr.splice(0,arr.length);
Array.prototype.deleteAt = function(index) { return this.splice(index, 1); };
Array.prototype.deleteItems = function (ids, filterEmpty = true) { var result = this.slice(); if (typeof ids === 'object' && ids.constructor === [].constructor) { ids.sort(function (a, b) { return b > a; }).forEach(function (value) { if (filterEmpty) { result.splice(value, 1); } else { ...