Test name | Executions per second |
---|---|
substring | 48809524.0 Ops/sec |
replace | 6737930.0 Ops/sec |
const a = "Omnipotent";
const pos = 3;
"<strong>" + a.substring(0, pos) + "</strong>" + a.substring(pos);
const a = "Omnipotent";
const sub = "Omn"
a.replace(sub, "<strong>" + sub + "</strong>");