I have a jsfiddle that you can check out here.
In the fiddle, we are able to add new nodes and delete all children in the parent node. However, my question is how can I delete a specific child without having to iterate through the array? I am aware that we have a method called Array.prototype.splice() that can be used for this purpose.
Array.prototype.splice()
If we want to remove a particular object like the one shown in screenshot #1, we can obtain its index and use the splice() method.
https://i.sstatic.net/RAwh2.png
But what if I want to remove a deeply nested object without iterating through the entire array for performance reasons?
https://i.sstatic.net/6IpvM.png
Currently, when I console.log, I only see:
Object { name: "Node-8-6-2", menu: false, $$hashKey: "object:151" }
This means I do not have direct access to the nodes of the parent array, and hence need to iterate through the entire array to remove it.
Does anyone have a solution to this problem?