PRO
Jacob
asked

Expert
Abhay Jajodia answered
Hi Jacob,
== compares values after JavaScript may convert one type to another (type coercion).=== compares both the value and the type, with no conversion.
Example:
5 == "5" // true (string "5" is converted to number)
5 === "5" // false (number vs string)
Most of the time, === is safer because it avoids surprising conversions.
If you have more questions, I am here to help π
JS
This question was asked as part of the Learn JavaScript Basics course.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer
