The == and != operators do type coercion before comparing values. This is bad because it can mask type errors. For example, it evaluates ' \t\r\n' == 0 as true.

It is best to always use the side-effect-less === and !== operators instead.

Noncompliant Code Example

if (var == 'howdy') {...} // Noncompliant

Compliant Solution

if (var === 'howdy') {...}