Skip to content

Commit a253933

Browse files
authored
upt: edit 二叉树理论基础.md
添加JavaScript版的二叉树节点定义方式
1 parent aad3cd7 commit a253933

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

problems/二叉树理论基础.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@ type TreeNode struct {
223223
}
224224
```
225225

226+
JavaScript:
227+
```
228+
function TreeNode(val, left, right) {
229+
this.val = (val===undefined ? 0 : val)
230+
this.left = (left===undefined ? null : left)
231+
this.right = (right===undefined ? null : right)
232+
}
233+
```
226234

227235

228236
-----------------------

0 commit comments

Comments
 (0)