How would I remove the whole sub array item from the following array where id = 2
in JavaScript/jQuery?
arr = [{
"id": 1,
"name": "Steve"
},{
"id": 2,
"name": "Martin"
},{
"id": 3,
"name": "Short"
}]
I am not sure how to use grep
or splice
in this situation.
My desired output would be:
newArr = [{
"id": 1,
"name": "Steve"
},{
"id": 3,
"name": "Short"
}]