-3

I need to remove a specific object with "id":"61d279c1d95e56527e2bdae8" from array of objects.

array would look like,

[
{
"id":"61d279c1d95e56527e2bdae8",
"name":"Cushlon Fleece Blanket (Solid, 150cmx230cm) - Dark Grey",
"price":2999,
"quantity":1
},
{
"id":"61ceaf75ebaef7ca9f60c7bb",
"name":"Skin Soft 100 % Cotton Super King Bedsheet With 2 Pillowcases - Pastel",
"productPictures":"i3bxaBh8a-pastel.jpeg",
"description":"sabdsjbfjsd",
"price":899,
"quantity":1
},
]
Sai Krishnadas
  • 2,863
  • 9
  • 36
  • 69

1 Answers1

-2

it's really simple by using the filter higher order function

const filteredArray = oldArray.filter(item=> item.id!=="61d279c1d95e56527e2bdae8")
majkl zumberi
  • 156
  • 1
  • 8