Похожие чаты

I am trying to delete object based on key is

there any better way I can achieve this?
https://bin.mkr.pw/~5f8f276f1b923e285d89c8bc

11 ответов

10 просмотров

What you mean by delete object? Just use Array#filter

decoder- Автор вопроса
Darvesh 🍀
What you mean by delete object? Just use Array#fil...

Sorry I mean children will move above for example I have object like { title: "a", id: "a", children: [ { title: "ab", children: [], id: "ab", }, { title: "ac", children: [ { title: "acc", children: [], id: "acc", }, ], id: "ac", }, ], }; and If I want to remove object id 'ac' then expected output will be { title: "a", id: "a", children: [ { title: "ab", children: [], id: "ab", }, { title: "acc", children: [], id: "acc", }, ], };

decoder
Sorry I mean children will move above for example ...

If you want to remove a then the children will move up?

From what I see, you just wanna remove duplicate entries

Похожие вопросы

Обсуждают сегодня

Карта сайта