What is the difference between == and === in JavaScript?

Learn the difference between == and ===, and understand which you should be using in your code.

By Craig Buckler
October 4, 2016
Screenshot from "What is the difference between == and === in JavaScript?" Screenshot from "What is the difference between == and === in JavaScript?"

On the surface == and === appear to be functionally the same, so why bother typing an extra character? In this video, Craig Buckler explains how == acts as an abstract equality comparison, and === a strict equality comparison. JavaScript beginners will learn the best practices relating to equality comparisons and experience fewer unexpected errors as a result.

Take the next step in JavaScript with our Beginning JavaScript Learning Path.

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
Share: