== Why is this an issue?

The use of comparison operators (``++<++``, ``++<=++``, ``++>=++``, ``++>++``) with strings is not likely to yield the expected results. Make sure the intention was to compare strings and not numbers.


=== Noncompliant code example

[source,javascript]
----
var appleNumber = "123";
var orangeNumber = "45";
if (appleNumber < orangeNumber) {  // Noncompliant, this condition is true
  alert("There are more oranges");
}
----


=== Compliant solution

[source,javascript]
----
var appleNumber = "123";
var orangeNumber = "45";
if (Number(appleNumber) < Number(orangeNumber)) {
  alert("There are more oranges");
}
----


=== Exceptions

The rule ignores string comparisons occurring in the callback of a sort invocation, e.g.:

[source,javascript]
----
const fruits = ['orange', 'apple', 'banana'];
fruits.sort((a, b) => a < b);
----


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::message.adoc[]

include::highlighting.adoc[]

'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
