EndsWith constant single character

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var s = "asdjhf galdfg aljdhfg ajlfdhgb fnmbv x,cvnb kxfgzbh f";
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
charAt fail
s.charAt(s.length - 1) === "g";
pending…
charAt pass
s.charAt(s.length - 1) === "f";
pending…
regex fail
/g$/.test(s);
pending…
regex pass
/f$/.test(s);
pending…

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

Compare results of other browsers

0 comments

Add a comment