📜  Javascript 获取调用者函数 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:29.245000             🧑  作者: Mango

代码示例1
function alertTheCallersName(){
    var callingFunctionName=alertTheCallersName.caller.name; //get the callers name here
    alert(callingFunctionName);
}

function someOtherFunction(){
   alertTheCallersName();
}
someOtherFunction();