JSFiddle - React, Tailwind, and code Playground
JavaScript
Array.prototype.removeIf = function(callback) {
var i = this.length;
while (i--) {
if (callback(this[i], i)) {
this.splice(i, 1);
}
}
};
ar = [ {num:1, str:"a"}, {num:2, str:"b"}, {num:3, str:"c"}, {num:4, str:"d"} ];
ar.removeIf(function(item, idx) {
return item.str == "c";
});
console.log(ar);