indexOf vs. charAt

Benchmark created on


Preparation HTML

<script>
  var s = 'xhdhdfhdfhdfjfjfgjgf';
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
indexOf
if(s.indexOf('x') === 0) {}
ready
charAt
if(s.charAt(0) === 'x') {}
ready

Revisions

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