1/**
2 * Definition for a binary tree node.
3 * function TreeNode(val, left, right) {
4 * this.val = (val===undefined ? 0 : val)
5 * this.left = (left===undefined ? null : left)
6 * this.right = (right===undefined ? null : right)
7 * }
8 */
9/**
10 * @param {TreeNode} root
11 * @return {number[]}
12 */
13var inorderTraversal = function(root) {
14 const res = []
15 const inorder = (root) => {
16 if (!root) return
17 inorder(root.left)
18 res.push(root.val)
19 inorder(root.right)
20 }
21 inorder(root)
22 return res
23};