Test name | Executions per second |
---|---|
.test | 2570422.8 Ops/sec |
.match | 2589300.8 Ops/sec |
modulo | 2654073.5 Ops/sec |
var string = "6.12";
var regex = /.\d1$/;
regex.test(String(string));
String(string).match(regex);
Math.floor(string * 100 % 100 / 10) === 1;