Closure TEST (v2)

Revision 2 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
ohne Closure
for (var i = 0; i < 10; i++) {
  document.getElementById('box' + i).onclick = function() {
    alert('You clicked on box #' + i);
  };
}
ready
mit Closure
for (var i = 0; i < 10; i++) {
  document.getElementById('box' + i).onclick = (function(index) {
    return function() {
      alert('You clicked on box #' + index);
    };
  })(i);
}
ready

Revisions

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