String.prototype.indexOf vs String.prototype.includes

Edit on GitHub

Setup

Tests

  • String.prototype.indexOf

    'Hello World'.indexOf('o') > -1
  • String.prototype.includes

    'Hello World'.includes('o')