Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0
Firefox 108
Windows
Desktop
2 years ago
Test name Executions per second
.endsWith 263701888.0 Ops/sec
.includes 34125276.0 Ops/sec
Script Preparation code:
x
 
var stringToCheck = 'askhgdhagksdh/asdas/';
var result = null;
Tests:
  • .endsWith

     
    result = stringToCheck.endsWith("/");
  • .includes

     
    result = stringToCheck.indexOf("/", stringToCheck.length - 1)