== Why is this an issue? Most checks against an ``++indexOf++`` call against an array compare it with -1 because 0 is a valid index. Any checks which look for values >0 ignore the first element, which is likely a bug. If you're merely checking the presence of the element, consider using ``++includes++`` instead. Before usingĀ ``++includes++`` method make sure that your browser version is supporting it. === Noncompliant code example [source,javascript] ---- var color = "blue"; var name = "ishmael"; var arr = [color, name]; if (arr.indexOf("blue") > 0) { // Noncompliant // ... } ---- === Compliant solution [source,javascript] ---- var color = "blue"; var name = "ishmael"; var arr = [color, name]; if (arr.indexOf("blue") >= 0) { // ... } if (arr.includes("blue")) { // ... } ---- == Resources https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes[Array.prototype.includes()] documentation at MDN ifdef::env-github,rspecator-view[] ''' == Implementation Specification (visible only on this page) === Message This check ignores index 0; consider using 'includes' method to make this check safe and explicit. ''' == Comments And Links (visible only on this page) === on 10 Apr 2017, 15:29:04 Elena Vilchik wrote: Temporary removed from SW before FP are removed: SONARJS-991 include::../comments-and-links.adoc[] endif::env-github,rspecator-view[]