javascript preorder
\n/**\n * Definition for a binary tree node.\n * function TreeNode(val) {\n *     this.val = val;\n *     this.left = this.right = null;\n * }\n */\n\n/**\n * E
```\n/**\n * Definition for a binary tree node.\n * function TreeNode(val) {\n *     this.val = val;\n *     this.left = this.right = null;\n * }\n */\n\n/**\n * Encodes a tree to a single string.\n *\n * @param {TreeNode} root\n * @return {string}\n */\nvar serialize = function(root) {\n  if(!root) return \'\'\n  return "" + root.val + \',\' + serialize(root.left) + \',\' + serialize(root.right)\n};\n\n/**\n * Decodes your encoded data to tree.\n *\n * @param {string} data\n * @return {TreeNode}\n */\nvar deserialize = function(data) {\n    const arr = data.split(\',\')\n    return helper(arr)\n    \n    function helper(arr) {\n        const val = arr.shift()\n        if(!val) return null \n        const node = new TreeNode(val)\n        node.left = helper(arr)\n        node.right = helper(arr)\n        return node\n    }\n    \n    \n};\n\n/**\n * Your functions will be called as such:\n * deserialize(serialize(root));\n */\n ```
['JavaScript']