O'Reilly logo

Rediscovering JavaScript by Venkat Subramaniam

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

Stay One Step Ahead

The traps we saw have been part of JavaScript for a long time. Even though the language has evolved considerably, these gotchas are inherent and they’re here to stay. Thankfully, we can make a preemptive strike to avert these issues using some tools and techniques.

Apply the use strict Directive

Placing ’use strict’; at the beginning of a JavaScript source file or within a function turns on the strict mode of execution. In this mode, the execution runtime does not tolerate, among other things, use of undeclared variables.

If the directive is placed at the top of a script, then all code in the script runs in the strict mode. If placed only within a function, then only the code within that function runs in the strict mode—the ...

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