javascript
\nvar preorderTraversal = function(root) {\n    let result = [];\n    dfs(root);\n    \n    function dfs(root) {\n        if(root != null){\n            result.
```\nvar preorderTraversal = function(root) {\n    let result = [];\n    dfs(root);\n    \n    function dfs(root) {\n        if(root != null){\n            result.push(root.val);\n            dfs(root.left);\n            dfs(root.right);\n        }\n    }\n    return result;\n};\n```
[]