nodejs example, extract str and var to separate functions