Previous: , Up: Source Files   [Contents][Index]

10.1.2 ECMAScript Strict Mode

ECMAScript 5’s Strict Mode throws errors in more situations that may lead to buggy code, allows for better optimization of ECMAScript code during runtime, and prohibits syntax that conflicts with future ECMAScript versions. It also enables certain features, like using let inside blocks.

It should always be enabled going forward as shown in Figure 10.3. The statement should immediately follow the copyright header (see Copyright Header), before any other code.

// Copyright header

'use strict';

// ...

Figure 10.3: Enabling strict mode