JSFiddle - React, Tailwind, and code Playground
by Dmitry Morar
JavaScript
let oldArr = [
{
id: "ODc5NjcxNjIzNzUwMQ==",
label: "Merkliste",
products: ["182441"]
},
{
id: "ODc5OTAwOTQ3MzIxMw==",
label: "Look1Bild1",
products: ["24078", "17412", "181257", "182441", "182314", "2202070"]
}
];
let shopName = 'Look1Bild1';
oldArr.map((current) => {
if (current.label === shopName) {
current.products = [];
}
})
console.log(oldArr)