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

0

Strict Mode adds certain compulsions to JavaScript. Under the strict mode, JavaScript shows errors for a piece of codes, which did not show an error before, but might be problematic and potentially unsafe. Strict mode also solves some mistakes that hamper the JavaScript engines to work efficiently.
Strict mode can be enabled by adding the string literal "use strict" above the file. This can be illustrated by the given example:
function myfunction() { "use strict"; var v = "This is a strict mode function";}

asked Apr 14, 2023 at 19:56
Sign in to add a comment

0 Answers

0
📝 No answers yet!

Be the first to answer this interview question.

Your Answer

Sign in to post your answer and help the community.