Expert Developer JavaScript Question: Download Expert JavaScript Developer PDF

Why would you include 'use strict' at the beginning of a JavaScript source file?

Tweet Share WhatsApp

Answer:

Using strict mode enforces stricter error handling when running your code. It essentially raises errors that would have otherwise failed silently. Using strict mode can help you avoid simple mistakes like creating accidental globals, undefined values, or duplicate property names. This is typically a good idea when writing JavaScript, as such errors can create a lot of frustrating side effects and be difficult to track down.

Download Expert JavaScript Developer PDF Read All 150 Expert JavaScript Developer Questions
Previous QuestionNext Question
What is Shift() method in Javascript?How can a particular frame be targeted, from a hyperlink, in JavaScript?