Java Reference
In-Depth Information
(function() {
"use strict";
// All your code would go inside this function
}());
Placing "use strict" at the beginning of a file will enforce strict mode on all the
JavaScript in the file, and if you are using anybody else's code, there's no guarantee that
they've coded in strict mode. This technique will ensure that only your code is forced to
use strict mode.
Linting Tools
Linting tools such as JS Lint, JS Hint, and ES Lint can be used to test the quality of
JavaScript code, beyond simply using strict mode. They are designed to highlight any
sloppy programming practices or syntax errors, and will complain if certain style conven-
tions are not followed, such as how code is indented. They can be very unforgiving and use
some opinionated coding conventions, such as not using the ++ and -- increment operat-
ors (in the case of JS Lint).
Passing a lint test is no guarantee that your code is correct, but it will mean it will be more
consistent and less likely to have problems. Some of the errors and warnings that these
tools produce can be difficult to understand, but the brilliant JS Lint Error Explanations site
is a helpful resource when trying to interpret them.
 
Search WWH ::




Custom Search