Create Tree From Array Javascript Function Expression