79361340

Date: 2025-01-16 11:13:06
Score: 0.5
Natty:
Report link

The new solution

As of 2015, browsers support Array.prototype.includes (caiuse, MDN) and with this you don't need to use indexOf.

if (['item1', 'item2'].includes(variable)) {
  // logic
}
Reasons:
  • Low length (1):
  • Has code block (-0.5):
Posted by: weroro