why does this not work

Benchmark created by rlemon on


Preparation HTML

<div id="test"></div>
<script>
  var str = "Hello World!";
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
set h
var h = str.slice(0, -1);
document.getElementById("test").innerHTML = h;
ready
substr returns nothing
var h = str.substr(0, -1);
document.getElementById("test").innerHTML = h;
ready

Revisions

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

  • Revision 1: published by rlemon on