I've integrated a tree view into my Angular project and I'm looking to add an object to a specific position within an array.
array
const TREE_DATA: TreeNode[] = [{"name":"Demo","id":"demo_1","children":[{"name":"Folder","id":"folder_1","children":[{"name":"File","id":1},{"name":"Doc","id":2}]},{"name":"Folder 2","id":"folder_2","children":[{"name":"doc file","id":3},{"name":"word","id":4}]}]},{"name":"Projects","id":"pro_1","children":[{"name":&...
const obj = { name: 'information', id: 50 }
and expected is
[{"name":"Demo","id":"demo_1","children":[{"name":"Folder","id":"folder_1","children":[{"name":"File","id":1},{"name":"Doc","id":2}]},{"name":"Folder 2","id":"folder_2","children":[{"name":"doc file","id":3},{"name":"word","id":4}]}]},{"name":"Projects","id":"pro_1","c...
How do I insert the object at a specific position based on its Id in the array?