preorderTraversal = function(root) {
    
    const dfs = (node, pre) => {
        if (!node) return pre;
        pre.push(node.val);
        dfs(node.left, pre);
        dfs(node.right, pre);
        return pre;
    }

    return dfs(root, []);
}
Pre-order-traversal
Time O(n) | Space O(n)
https://leetcode.com/problems/binary-tree-preorder-traversal/
@param {TreeNode} root
@return {number[]}