AVL tree in javascript