Javascript binanary heap