Is there a way to get the name of the caller function within the callee?
You used to be able to do arguments.caller.name
, but this is deprecated in Javascript 1.3.
arguments.callee.caller.name
(or just showMe.caller.name
) is another way to go. This is non-standard, and not supported in strict mode, but otherwise currently supported in all major browsers (ref).
Try callee.caller
like this
function showMe() {
// should log the runMe as the caller and showMe as callee
console.log('Callee: ',arguments.callee.name)
console.log('Caller: ',arguments.callee.caller.name);
}