Tree javascript