I've read the numerous posts here on stack overflow about how to use
arguments.callee.caller or arguments.callee.caller.toString()
If you do a simple search, you can find a bunch of posts about this.
So, i decided to try this myself! However, I'd like to find the name of the function inside of a javascript object, but it seems to be returning the code inside of the function, instead of the actual function name.
Here is the jsFiddle: http://jsfiddle.net/4Cp5Z/18/.
To summarize, I make a new app, then call app.testFunction
. testFunction()
calls receiver()
, and I'm expecting var name
to be equal to testFunction
app = function() {
this.testFunction = function() {
this.receiver();
};
this.receiver = function() {
var name = this.receiver.caller.toString();
// this.receiver.caller.name outputs nothing...
};
};