fix missing ; and undeclared local var, fixes #16520

fixes various JS typo/errors. See https://bugs.dojotoolkit.org/ticket/16520