💡JavaScript Solution
The idea\n1. Similar to removing a node in BST, we use recursion and backtracking to traverse and removing nodes.\n2. We only add node to the result when it\'s 
### The idea\n1. Similar to removing a node in BST, we use recursion and backtracking to traverse and removing nodes.\n2. We only add node to the result when it\'s both the root and not deleted. \n3. A technique used here is that whenever we found a node to be deleted, we don\'t return `null` right away. This will cut off our paths to other nodes. Instead, we save its state as `shouldDelete` and set it to `null` in the backtracking stage.\n``` javascript\n/**\n * @param {TreeNode} root\n * @param {number[]} to_delete\n * @return {TreeNode[]}\n */\nvar delNodes = function(root, to_delete) {\n    let roots = [];\n    let helper = function(root, isRoot) {\n        if (!root) return null;\n        let shouldDelete = to_delete.includes(root.val);\n        if (isRoot && !shouldDelete) roots.push(root);\n        root.left = helper(root.left, shouldDelete);\n        root.right = helper(root.right, shouldDelete);\n        return shouldDelete?null:root;\n    }\n    helper(root, true);\n    return roots;\n};\n```
['JavaScript']