Test case details

Preparation Code

var three = threeFn;     var four = fourFn;     var five = five();     var six = six();         function TraditionalPrototypeClass() {     }         TraditionalPrototypeClass.prototype.foo = function() {     };         TraditionalPrototypeClass.prototype.bar = function() {     };         function ModulePatternClass() {         this.foo = function() {         };                 this.bar = function() {         };     }         var ModuleCachePatternClass = (function () {         function foo() {         }                 function bar() {         }                 return function () {             this.foo = foo;             this.bar = bar;         };     }());         var standardObject = {         foo: function(){         },         bar: function(){         }     };         var standardObjectFnCall = {         foo: one(),         bar: two()     };         var standardObjectDeclaredFnCall = {         foo: three(),         bar: four()     };         var standardObjectFnVar = {         foo: five,         bar: six     };         function one() {     }     function two() {     }         function threeFn() {     }         function fourFn() {     }         function five() {     }         function six() {     }

Test cases

Test #1

var o = new TraditionalPrototypeClass() o.bar; o.foo;

Test #2

var o = new ModulePatternClass() o.bar; o.foo;

Test #3

var o = new ModuleCachePatternClass() o.bar; o.foo;

Test #4

var o = standardObject; o.bar; o.foo;

Test #5

var o = standardObjectFnCall; o.bar; o.foo;

Test #6

var o = standardObjectDeclaredFnCall; o.bar; o.foo;

Test #7

var o = standardObjectFnVar; o.bar; o.foo;