Is it safe to change == to === according to jshint's error detection without further checking-Collection of common programming errors

Replacing == by === is a recommendation because it makes the code easier to predict and less error prone. Douglas Crockford proposes to never use ==. However it is just his opinion.

Actually, if you have such checks in your code and know what you are doing (that the types will get coerced) and perhaps are even relying on that behaviour, it is absolutely okay to work with those comparisons. You can just uncheck the “Warning about unsafe comparison”.

If you want to replace those comparisons you definitely have to check if your code keeps working as intended.

Originally posted 2013-11-09 23:30:09.