Your functions are anonymous functions. For the JavaScript Interpreter f1
, f2
and f3
are just variable names. Consider the following code:
var foo = function(a) {
return f2(a + 1);
};
var f1 = foo;
foo = "bar"
The intepreter and thus FireBug cannot know, whether the function name is foo
, f1
or something completely differnt. For the interpreter it is just an anonymous function. You can rewrite your code using named functions like this:
function f1(a) {
return f2(a + 1);
};
You can even assign the named function to a variable:
var f1 = function f1(a) {
return f2(a + 1);
};
In this case the function name will always be f1
regardless of the variable's name.
Newer builds of the WebKit and Chrome Inspector support the displayName
property on functions 1. If an anonymous function has such a property, the value of the property is used as the function name. In your code you could e.g. write:
var f1 = function(a) {
return f2(a + 1);
};
f.displayName = "f1".