I am encountering an issue with my JS class structure:
class Tree {
constructor(rootNode) {
this._rootNode = rootNode;
rootNode.makeRoot();
}
getRoot() {
return this._rootNode;
}
findNodeWithID(id) {
return this.findNode(this._rootNode, id);
}
...Some more code here...
}
There are two main problems I need to address:
The specified syntax resulted in a compilation error
findNode = (node, id) => { ^ SyntaxError: Unexpected token =
When tinkering with it and altering the function type
findNode = (node, id) => {
...
}
It appears that changing the method structure disrupts the functionality of findNodeWithID. Any thoughts on why this may be happening?