i have an array of objects
const arr=[
{
"id": "C3-Delta-65",
"name": "C3-Delta-65",
"carts": [
{
"id": "full",
"name": "Full Cart",
"weight": 0,
"volume": 0,
"dimensions": {
"length": 0,
"breadth": 0,
"height": 0
},
"quantity": 5
},
{
"id": "half",
"name": "Half Cart",
"weight": 0,
"volume": 0,
"dimensions": {
"length": 0,
"breadth": 0,
"height": 0
},
"quantity": 3
},
{
"id": "smu",
"name": "SMU",
"weight": 0,
"volume": 0,
"dimensions": {
"length": 0,
"breadth": 0,
"height": 0
},
"quantity": 2
}
]
},
{
"name": "C3-Delta-65",
"id": "C3-Delta-65",
"carts": [
{
"id": "full",
"name": "Full Cart",
"weight": 0,
"volume": 0,
"dimensions": {
"length": 0,
"breadth": 0,
"height": 0
},
"quantity": 5
},
{
"id": "half",
"name": "Half Cart",
"weight": 0,
"volume": 0,
"dimensions": {
"length": 0,
"breadth": 0,
"height": 0
},
"quantity": 3
},
{
"id": "smu",
"name": "SMU",
"weight": 0,
"volume": 0,
"dimensions": {
"length": 0,
"breadth": 0,
"height": 0
},
"quantity": 2
}
]
},
{
"name": "B1-Bravo-31",
"id": "B1-Bravo-31",
"carts": [
{
"quantity": 3,
"dimensions": {
"height": 0,
"breadth": 0,
"length": 0
},
"volume": 0,
"weight": 0,
"name": "Full Cart",
"id": "full"
},
{
"quantity": 4,
"dimensions": {
"height": 0,
"breadth": 0,
"length": 0
},
"volume": 0,
"weight": 0,
"name": "Half Cart",
"id": "half"
},
{
"quantity": 2,
"dimensions": {
"height": 0,
"breadth": 0,
"length": 0
},
"volume": 0,
"weight": 0,
"name": "SMU",
"id": "smu"
}
]
}
]
i want to remove the object rem from the arr array only once right now there are two rem objects which are exactly the same as rem object. i need the whole rem object to be compared and deleted from arr array instead of using a key from rem to be compare with arr array is this possible.
const rem={
"name": "C3-Delta-65",
"id": "C3-Delta-65",
"carts": [
{
"quantity": 5,
"dimensions": {
"height": 0,
"breadth": 0,
"length": 0
},
"volume": 0,
"weight": 0,
"name": "Full Cart",
"id": "full"
},
{
"quantity": 3,
"dimensions": {
"height": 0,
"breadth": 0,
"length": 0
},
"volume": 0,
"weight": 0,
"name": "Half Cart",
"id": "half"
},
{
"quantity": 2,
"dimensions": {
"height": 0,
"breadth": 0,
"length": 0
},
"volume": 0,
"weight": 0,
"name": "SMU",
"id": "smu"
}
]
}