Create Tree Data Structure Javascript Array Methods