💡JavaScript Solution - Preorder
The idea\n1. Utilize the fact BST can be reconstructed from preorder/postorder array\njavascript\nvar serialize = function(root) {\n    let preorder = [];\n    
### The idea\n1. Utilize the fact BST can be reconstructed from preorder/postorder array\n``` javascript\nvar serialize = function(root) {\n    let preorder = [];\n    let dfs = function(node) {\n        if (node==null) return;\n        preorder.push(node.val);\n        dfs(node.left);\n        dfs(node.right);\n    }\n    dfs(root);\n    return preorder.join(\',\');\n};\n\n var deserialize = function(data) {\n    if (data == \'\') return null;\n    let preorder = data.split(\',\');\n    let recur = function(lower, upper) {\n        if (Number(preorder[0]) < lower || Number(preorder[0]) > upper) return null;\n        if (preorder.length == 0) return null;\n        let root = new TreeNode(preorder.shift());\n        root.left = recur(lower, root.val);\n        root.right = recur(root.val, upper);\n        return root;\n    }\n    return recur(-Infinity, Infinity);\n};\n\n/**\n * Your functions will be called as such:\n * deserialize(serialize(root));\n */\n```
['JavaScript']