Strict mode in JS is a special feature that allows programmers to actively enforce a set of rules and restrictions, which are not applied by default.

To enable strict mode in JavaScript, you simply need to add the following line at the beginning of your code or function:

'use strict';

Below are some common errors that strict mode can detect:

  • Using an uninitialized variable
  • Exceeding the limit on parameter identifiers
  • Duplicate property names in an object
  • Using eval in a local scope
  • Invalid hexadecimal syntax
  • Deleting a non-deletable property