I having issues understanding the proper way to convert a string like so tree.descendents[0].descendents
to a object that I can manipulate.
I was seeing that reduce was the way to go, however I couldn't wrap my head around it.
Any suggestions/pointers appreciated.
class TreeNode {
constructor(value) {
this.value = value;
this.descendents = [];
}}
As you can see I might be deep within the tree object. I am trying to access it by getting the path to my target then set its value. ideally I convert the path to a object and do: myPath.descendents.push(myNewElement)