The Code

To get you off the ground, feel free to use the code bits below. The first is for a basic tree Node:

class Node{  constructor(val){    this.value = val;    this.children = [];  }  addChild(val){    const newNode = new  (val);    this.children.push(newNode);    return newNode;  }}module.exports =  Node;

Here’s one for a BinaryTreeNode

class BinaryTreeNode{  constructor(val){    this.value = val;    this.right = null;    this.left = null;  }  addRight(val){    const newNode = new BinaryTreeNode(val);    this.right = newNode;    return newNode;  }  addLeft(val){    const newNode = new BinaryTreeNode(val);    this.left = newNode;    return newNode;  }}