Adding treeset in javascript