find if an element is present in an array and remove code example
Example 1: remove object from array by name javascript
var id = 88;
for(var i = 0; i < data.length; i++) {
if(data[i].id == id) {
data.splice(i, 1);
break;
}
}
Example 2: remove element from array lodash
var arr = [1, 2, 3, 3, 4, 5];
_.remove(arr, function(e) {
return e === 3;
});
console.log(arr);