I have an array of objects
[
{name: 'hello', children: [{name: 'a'}, {name: 'b'}],
{name: 'world', children: [{name: 'c'}, {name: 'd'}],
]
What is the most effective way to turn this array into this by using array methods?
[{name: 'a'}, {name: 'b'}, {name: 'c'}, {name: 'd'}]
I've tried using map and filter but the subelements were still in chunks. Thanks in advance.
reduce()and array concatenation (either withconcat()or[...array1, ...array2])