var tree= {}, {"value":1;"left":tree[2];"right":tree[3]}, {"value":2;"left":tree[4];"right":tree[5]}, {"value":3;"left":tree[6];"right":""}, {"value":4;"left":tree[7];"right":""}, {"value":5;"left":"";"right":tree[8]}, {"value":6;"left":"";"right":""}, {"value":7;"left":"";"right":""}, {"value":8;"left":"";"right":""} ] function bianli(node){ if(!node["left"]){bianli(node.left)} console.log(node{"value"}); if(!node.right)(bianli(node["right"])); } bianli(tree[1])