binary search tree code bricks in JavaScript