includes vs indexOf

Edit on GitHub

Array.prototype.includes vs Array.prototype.indexOf

Setup

Tests

  • includes

    ['string1', 'string2'].includes('string1')
  • indexOf

    ['string1', 'string2'].indexOf('string1')