indexOf vs. charAt (v4)

Revision 4 of this benchmark created by Germán Toro del Valle on


Preparation HTML

<script>
  var s = '+346666';
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
indexOf
if (s.indexOf("x") === 0) {}
ready
charAt
if (s.charAt(0) === "x") {}
ready
array
if (s[0] === "x") {}
ready

Revisions

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