javascript
\nvar kthSmallest = function(root, k) {\n    let array = []\n    dfs(root)\n    return array[k - 1]\n    \n    function dfs(root){\n        if(!root){\n        
```\nvar kthSmallest = function(root, k) {\n    let array = []\n    dfs(root)\n    return array[k - 1]\n    \n    function dfs(root){\n        if(!root){\n            return\n        }\n        dfs(root.left)\n        array.push(root.val)\n        dfs(root.right)\n    }\n};\n```
[]