Javascript DFS
\nvar isBalanced = function(tree) {\n\tlet isBalanced = true\n\tfunction dfs(t){\n\t\tif(!t) return 0\n\t\tconst left = dfs(t.left)\n\t\tconst right = dfs(t.rig
```\nvar isBalanced = function(tree) {\n\tlet isBalanced = true\n\tfunction dfs(t){\n\t\tif(!t) return 0\n\t\tconst left = dfs(t.left)\n\t\tconst right = dfs(t.right)\n\t\tif(Math.abs(left-right) > 1){\n\t\t\tisBalanced = false\n\t\t}\n\t\treturn 1 + Math.max(left, right)\n\t}\n\tdfs(tree)\n  return isBalanced;    \n};\n```
['Depth-First Search', 'JavaScript']