string_slice_vs_length-1 (v6)

Revision 6 of this benchmark created by Michael Best on


Setup

var s = " I am so glad to hear about you.";
    var e = ".";

Test runner

Ready to run.

Testing in
TestOps/sec
slice
var a = s.slice(-1);
if (a !== e) {
  console.log(a + " doesn't match " + e);
}
ready
length-1
var a = s[s.length - 1];
if (a !== e) {
  console.log(a + " doesn't match " + e);
}
ready

Revisions

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