Traversing javascript syntax tree