O'Reilly logo

jQuery Design Patterns by Thodoris Greasidis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using ES5 Strict Mode

A small but precious addition to all the Module Patterns that use IIFEs as their basic building blocks, is the use of Strict Mode for JavaScript execution. This was standardized in the fifth edition of JavaScript, and is an opt-in execution mode with slightly different semantics, in order to prevent some of the common pitfalls of JavaScript, but also having backwards compatibility in mind.

Under this mode, the JavaScript runtime engine will prevent you from accidentally creating a global variable and polluting the Global Namespace. Even in not-so-large applications, it is quite possible that a var declaration before the initial assignment of a variable can be missing, automatically promoting that to a global variable. To ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required