function main()
{
Hello();
}
function Hello()
{
// How do you find out the caller function is \'main\'?
}
Is there a way to find out the call
Try the following code:
function getStackTrace(){
var f = arguments.callee;
var ret = [];
var item = {};
var iter = 0;
while ( f = f.caller ){
// Initialize
item = {
name: f.name || null,
args: [], // Empty array = no arguments passed
callback: f
};
// Function arguments
if ( f.arguments ){
for ( iter = 0; iter
Worked for me in Firefox-21 and Chromium-25.