I had no idea switch was contraindicated.  The errors are because I forgot to run jslint, which I'll do.