Complete the code to create a new node with value 10.
const root = new TreeNode([1]);The TreeNode constructor expects a number value. Using 10 correctly creates the root node.
Complete the code to assign a left child node with value 5 to the root.
root.left = new TreeNode([1]);Assigning a new TreeNode with value 5 as the left child correctly builds the left subtree.
Fix the error in the code to assign a right child node with value 15 to the root.
root.right = new TreeNode([1]);The value must be a number, so 15 without quotes is correct.
Fill both blanks to create a left child with value 3 and a right child with value 7 for the left node.
root.left.left = new TreeNode([1]); root.left.right = new TreeNode([2]);
Assigning 3 and 7 as left and right children of root.left builds the subtree correctly.
Fill all three blanks to first create the right child of the root with value 15, then create its left child with value 17 and right child with value 25.
root.right = new TreeNode([3]); root.right.left = new TreeNode([1]); root.right.right = new TreeNode([2]);
First, root.right is assigned 15, then its left and right children are assigned 17 and 25 respectively.