Fixed undefined variables

Added JSHint for code linting