Extremely Elegant and Simple JavaScript solution
My serialized list takes the form of: \n[root, <elements smaller than root>, <elements bigger than root>] and this is true recursively. I cheated a little bit b
My serialized list takes the form of: \n`[root, <elements smaller than root>, <elements bigger than root>]` and this is true recursively. I cheated a little bit by using `JSON.stringify` and `JSON.parse` but the general idea is there.\n\n```\nvar serialize = function(root) {\n    function traverse(node) {\n        if (!node) {\n            return [];\n        }\n        return [node.val].concat(traverse(node.left), traverse(node.right));\n    }\n    return JSON.stringify(traverse(root));\n};\n\nvar deserialize = function(data) {\n    function construct(arr) {\n        if (!arr.length) {\n            return null;\n        }\n        const root = new TreeNode(arr[0]);\n        root.left = construct(arr.filter(num => num < root.val));\n        root.right = construct(arr.filter(num => num > root.val));\n        return root;\n    }\n    return construct(JSON.parse(data));\n};\n```
[]