JSFiddle - React, Tailwind, and code Playground
by Md Shah
JavaScript
function removeItem(objArray, key, removeValue) {
var outArr = [];
$.each(ds, function (ind, val) {
if (val[key] != removeValue) outArr.push(val)
});
return outArr;
}
var j = '[{"item":"Hello"},{"item":"Funny"},{"item":"World"},{"color":"red"}]';
var ds = JSON.parse(j);
var obj = {};
obj["item"] = "Silly";
ds.push(obj);
ds = removeItem(ds, 'item', 'Funny'); // DELETE "item":"Funny"
ds = removeItem(ds, 'item', 'Silly');// DELETE "item":"Silly"
alert(JSON.stringify(ds));