Who calls me?
If that’s the question a JavaScript function is asking for, and respectively you are, there is one simple way to find the answer.
Why would I need this?
Well let assume I’ve one function called func1, called by both func2 and func3, explained into the following example:
How I’d finally understand the answer?
Well if you’re using Firefox, I guess you are if web developing is your job, just add a console.log to see the caller function. Like in the above example. The answer can be seen in the Firebug console:
That is fine enough to understand the caller function and if needed to debug the js application. You need only to make for the test a simple HTML file. Example:
Download
You can download the example from here, or visit the download page.