Function Declarations vs. Function Expressions (v7)

Revision 7 of this benchmark created by Andrew Mottaz on


Test runner

Ready to run.

Testing in
TestOps/sec
Function Declaration
function X() { return "hello"; }
function Y() { return X(); }
function Z() { return Y(); }
Z();
ready
Function Expression
var X = function () { return "hello"; };
var Y = function () { return X(); };
var Z = function () { return Y(); };
Z();
ready
Function Expression 2
var X = function () { return "hello"; },
Y = function () { return X(); },
Z = function () { return Y(); };
Z();
ready
json
tester = {
  X: function(){return "hello";},
  Y: function(){return this.X();},
  Z: function(){return this.Y();}
};
tester.Z();
 
ready

Revisions

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