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.

By Craig Buckler
October 10, 2016
Screenshot from "What does “use strict” do in JavaScript?" Screenshot from "What does “use strict” do in JavaScript?"

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.

Learn faster. Dig deeper. See farther.

Join the O'Reilly online learning platform. Get a free trial today and find answers on the fly, or master something new and useful.

Learn more

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.

Post topics: Web Programming
Post tags: Questions