Test name | Executions per second |
---|---|
RegEx.test | 6477905.5 Ops/sec |
String.includes | 16284668.0 Ops/sec |
String.match | 3648802.0 Ops/sec |
String.match with regex | 4757637.0 Ops/sec |
var string = "Hello world!";
var regex = /Hello/g;
regex.test(string);
string.includes("Hello");
string.match("Hello");
string.match(regex);