javascript
\nvar isSymmetric = function(root) {\n    if(!root) \n        return true;\n    return dfs(root.left, root.right);\n    \n    function dfs(leftNode, rightNode) 
```\nvar isSymmetric = function(root) {\n    if(!root) \n        return true;\n    return dfs(root.left, root.right);\n    \n    function dfs(leftNode, rightNode) {\n        if (!leftNode && !rightNode) {\n            return true;\n        }\n        if(leftNode && !rightNode || !leftNode && rightNode || leftNode.val !== rightNode.val) {\n            return false;\n        }\n        return dfs(leftNode.right, rightNode.left) && dfs(leftNode.left, rightNode.right);\n    }\n};\n```
[]