JavaScript

JavaScript

Made by DeepSource

Found flawed string comparison JS-W1040

Bug risk
Major
Autofix

The result of a call to String#toUpperCase should only be compared with an uppercase string. Calls like s.toUpperCase() === "Not-Uppercase" will always evaluate to false. Similarly, calls to toLowerCase should only be compared with lowercase strings.

Bad Practice

if (str.toLowerCase() === 'InJuly') {
  // ...
}

Recommended

if (str.toLowerCase() === 'injuly') {
  // ...
}