Expert Developer JavaScript Question:
Download Questions PDF

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

Expert JavaScript Developer Interview Question
Expert JavaScript Developer Interview Question

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 Interview Questions And Answers PDF

Previous QuestionNext Question
What is Shift() method in Javascript?How can a particular frame be targeted, from a hyperlink, in JavaScript?