mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 03:34:02 +08:00
upt: edit 二叉树理论基础.md
添加JavaScript版的二叉树节点定义方式
This commit is contained in:
@ -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)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
-----------------------
|
||||
|
Reference in New Issue
Block a user