little exercise with javascript trees