Javascript Array removeIf(predicate)
'use strict';//w w w .j ava2s . co m Array.prototype.removeIf = function (predicate) { var output = []; var i = this.length; while(i-- > 0) { if (predicate(this[i])) { output = output.concat(this.splice(i, 1)); } } return output.reverse(); };