lint, or a linter, basically is a tool that analyzes your code and basically highlights any errors, bugs, or even syntax errors.
let name = 'cyrus';
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz). (W104)jshint(W104)
As you can see, in the response a tool called jshint responded but remember the code does not have an error. To mitigate this all you have to do is tell the ide of the js version you are using to code with the following lines of code at the beginning of your js file;
// jshint esversion:6
There are other tools just like this that even highlight the errors in your code and we may not look at all of them in this post but you should have a look at;
Checks for errors, bugs, and issues with your code,
Checks whether there are any undeclared variables,
Checks the use or misuse of reserved keywords in your code.
This feature is particularly useful when you choose to refactor your code. You can use it in various code functions to ensure they execute smoothly and once satisfied apply it to the main .js file.
The syntax of placing the directive in your file is quite simple;
placed at either at the top of your .js file or at the beginning of the function. An example where this mode is effective in code is checking for undefined variables;
Which will highlight the variable name names and indicate that it's not defined with the help of jshint and once you try to run the code, the strict mode will produce a reference error on the same issue;
ReferenceError: names is not defined.
Thank you for taking your time to read this article and hopefully you'll follow me on Twitter and or stick around and have a look at more posts. I'd appreciate the gesture.