DFS.

```
var postorderTraversal = function(root) {
if (!root) return [];
var node = root;
var result = []
var traverse = function(node) {
if (node.left) {
traverse(node.left)
}
if (node.right) {
traverse(node.right)
}
result.push(node.val);
}
traverse(node);
return result;
};
```