JavaScript Best Practices: How to Use Code Checkers


show more Find the best tools for checking the quality of your JavaScript code. Simon Allardice shows how to use JSLint to make sure that your code is not only error free, but also following JavaScript programming best practices. show less
please wait ...

Using JavaScript code checkers

Just as we can run our JavaScript through a separate program to minify it, we can also run it through another program to check its quality, and to check it for common problems. Now in contrast to minification where there are many different tools to choose from, there is one best known JavaScript code quality checker, which is JSLint by Douglas Crockford, whose the JavaScript architect at Yahoo! You can find this at jslint.com. With this what you can do is take some code--I have got a block of JavaScript here--I'm just going to copy, take it over the JSLint, paste it in there, and click this button that says JSLint, to check it.

Now, when you do this it's going to complain about a lot. JSLint will point out every little thing you do that isn't perfect, from the amount of whitespace you use between your operators, to how many characters you indent your code, to whether you declare all your variables using var, whether you are declaring your functions before you use them, and a ...

Using JavaScript code checkers
Video duration: 7m 37s 5h 31m Beginner

Viewers:

Find the best tools for checking the quality of your JavaScript code. Simon Allardice shows how to use JSLint to make sure that your code is not only error free, but also following JavaScript programming best practices.

Subjects:
Developer Web
Software:
JavaScript
Author:
please wait ...