getopt.js: simplify `nextchar` code.

I noticed the code was much longer than it needed to be.