var preorderTraversal = function(root) {
const res = []
preorderTraversalNode(root, (v) => res.push(v))
return res
};
var preorderTraversalNode = function(node, callback) {
if (node !== null) {
callback(node.val)
preorderTraversalNode(node.left, callback)
preorderTraversalNode(node.right, callback)
}
}