Add jshint linter and fix lint errors
jsHint for undefined variables
Remove unused globals
Use standard configs for jshint