JavaScript Scope Chain

JavaScript performance comparison

Test case created by Kyle Florence

Info

Test case for which access method is fastest in relation to the JavaScript scope chain.

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Private variables
(function(window) {
 var local = 0;

 window.obj = {
  test: function() {
   return local;
  }
 };
})(window);

obj.test();
pending…
Using 'this'
(function(window) {
 window.obj = {
  local: 0,
  test: function() {
   return this.local;
  }
 };
})(window);

obj.test();
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment