Run details:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36 EdgA/120.0.0.0
Chrome Mobile 120
Android
Mobile
one year ago
Test name Executions per second
.endsWith 5293608.5 Ops/sec
.includes 4866412.0 Ops/sec
Script Preparation code:
x
 
var string = 'car';
var stringToCheck = 'car';
var result = null;
Tests:
  • .endsWith

     
    result = stringToCheck.endsWith(string);
  • .includes

     
    result = stringToCheck.includes(string);