字符串操作-字符串替换

Benchmark created on


Setup

const str = 'hello world'; 

Test runner

Ready to run.

Testing in
TestOps/sec
正则替换
const newStr = str.replace(/world/, 'javascript'); 
ready
字符串替换
const newStr = str.replace('world', 'javascript');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.