add jshint and correction of undef var