regexp .test() vs string .includes() vs indexOf === 0 vs string .startsWith()| Test case name | Result |
|---|---|
| regexp .test() | |
| string .includes() | |
| indexOf === 0 | |
| string .startsWith() |
| Test name | Executions per second |
|---|---|
| ✓ string .includes() | 618,025,280 Ops/sec |
| string .startsWith() | 587,229,248 Ops/sec |
| indexOf === 0 | 568,251,776 Ops/sec |
| regexp .test() | 24,342,452 Ops/sec |