Binary search tree implemented using JavaScript