Stay One Step Ahead

Learn JavaScript's modern strict mode and make your code secure.

The traps we saw in the previous lesson 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 ...