With the help of “Strict Mode,” users can write secure Javascripts easily. It changes bad syntax into real errors. It can be declared by placing “use strict”; at the beginning of a function or script.

Advantages

  • It eliminates some JavaScript errors by changing them to throw errors.
  • Strict Mode prevents errors when some unsafe actions are taken.

Disadvantages

  • If a library that was in strict mode but by mistake used in normal mode then that might call some actions and wouldn’t work as expected.
  • One of the major disadvantages of using this mode is error might fail silently.
BY Best Interview Question ON 17 Jan 2021

Example

<script>
"use strict";
show();

function show() {
  y = 3.14;
}
</script>