What does “use strict” do in JavaScript?
Learn how “use strict” can introduce more robust error reporting to your JavaScript code and cut down on logical errors.
JavaScript is very forgiving. You can neglect to define variables, pass irregular arguments to functions, and execute code which would fail in other languages. This makes it easy to introduce logic errors that are difficult to debug. In this video Craig Buckler demonstrates how adding “use strict” to your functions can offer more robust reporting that will catch more logic errors. Novice developers in particular will be able to build better coding habits not already enforced by JavaScript.
Discover in-depth JavaScript training with our Safari Learning Paths.
Craig Buckler is an experienced Web Developer working in the UK who started his career creating desktop software. Craig has worked for a number of well-known companies, including Microsoft, MSN, and Thomson Reuters, as well as the UK & EU governments. Craig is the prolific author of countless articles and tutorials on HTML5, CSS3, JavaScript, JQuery, PHP, and Node.js.