Suspicious use of the Unequal To operator

Note

The Suspicious use of the Unequal To operator code issue is JavaScript specific.

CodeRush Classic shows the Suspicious use of the Unequal To operator code issue if the "!=" operator is used to compare values.

Fix

Replace the "!=" operator with "!==".

Purpose

Highlights usages of the "!=" operator, which can be replaced with the "!==" operator for strict comparison.

Example

if (obj1 != obj2)
    document.createTextNode("Objects are unequal"));

Fix:

if (obj1 !== obj2)
    document.createTextNode("Objects are unequal"));