Expert Developer JavaScript Question: Download Expert JavaScript Developer PDF
Why would you include 'use strict' at the beginning of a JavaScript source file?
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.
Previous Question | Next Question |
What is Shift() method in Javascript? | How can a particular frame be targeted, from a hyperlink, in JavaScript? |