arr = [
{id:1,name:""},
{id:2,name:"", children:[
{id:4,name:""}
]},
{id:3,name:""}
];
how do you reorder the array above into the following format?
newArr = [
{id:1,name:""},
{id:2,name:""},
{id:4,name:""}
{id:3,name:""}
];
guys, help me take a look. Thank you