(
function
() {
'use strict'
;
// all of your code goes here...it
// is executed in strict mode, but
// the strict mode won't contaminate
// any other scripts that are combined
// with this one
})();
Strict mode is generally considered a good thing, and I recommend you use it. If
you’re using a linter (and you should be), it will save you from many of the same
problems, but doubling up can’t hurt!
To learn more about what strict mode does, see the
Conclusion
Understanding scope is an important part of learning any programming language.
The introduction of
let
brings JavaScript in line with most other modern languages.
While JavaScript is not the first language to support closures, it is one of the first
popular (nonacademic) languages to do so. The JavaScript community has used clo‐
sures to great effect, and it’s an important part of modern JavaScript development.
Conclusion | 129