Exercise on JS. Function to traverse a tree and add the numbers on each node.