JavaScript · Junior · Question 49 of 75
What does the 'use strict' directive give you?
- ✓Correct answer: Strict mode: errors instead of silent failures and a ban on dangerous constructs
- 2Static type checking at runtime, as in TypeScript
- 3Automatic minification and optimization of code by the engine
Explanation
For example, assigning to an undeclared variable throws instead of creating a global, and this in a regular function is undefined, not window. Modules and classes run in strict mode automatically.