Javascript Array removeIf(callback)
Array.prototype.removeIf = function(callback) { var i = this.length; while (i--) { if (callback(this[i], i)) { this.splice(i, 1);/*w w w .jav a2 s . co m*/ } } };