What is the 'Strict' mode in JavaScript and how can it be enabled?

What is the ‘Strict’ mode in JavaScript and how can it be enabled?

Strict Mode was a new feature in ECMAScript 5 that allows you to place a program, or a function, in a “ strict ” operating context. This strict context prevents certain actions from being taken and throws more exceptions. Strict mode eliminates some JavaScript silent errors by changing them to throw errors.

You can enable strict mode in JavaScript by adding the following line on top of your JS script:

use strict;