JavaScript Tree Searches