Simple descition tree on JavaScript