upt: edit 二叉树理论基础.md

添加JavaScript版的二叉树节点定义方式
This commit is contained in:
Junwen Huang
2021-08-12 10:10:23 +08:00
committed by GitHub
parent aad3cd7f45
commit a2539333a0

View File

@ -223,6 +223,14 @@ type TreeNode struct {
}
```
JavaScript
```
function TreeNode(val, left, right) {
this.val = (val===undefined ? 0 : val)
this.left = (left===undefined ? null : left)
this.right = (right===undefined ? null : right)
}
```
-----------------------