The EcmaScript 5 definition includes a declaration to switch the engine running your code into so-called “strict mode.” This is often touted as an obviously beneficial way to catch programmer mistakes, because in strict mode a browser will throw runtime errors when it encounters script that, while not syntactically wrong, is at least bad practice.
Strict mode helps out in a couple ways:
- It catches some common coding bloopers, throwing exceptions.
- It prevents, or throws errors, when relatively “unsafe” actions are taken (such as gaining access to the global object).
- It disables features that are confusing or poorly thought out.