Function Declarations vs. Function Expressions (v25)

Revision 25 of this benchmark created 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
Function Expression Scope 1
var Z = function() {
  function Y() {
    function X() {
      return "hello";
    };
    return X();
  };
  return Y();
};
Z();
ready
Function Expression Scope 2
var Z = function() {
  var Y = function() {
    var X = function() {
      return "hello";
    };
    return X();
  };
  return Y();
};
Z();
ready
Function Expression Scope 3
var Z = function() {
  return function() {
    return function() {
      return "hello";
    };
  };
};
Z();
ready

Revisions

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