function CallLevel(){
if (CallLevel.caller == null)
return("CallLevel was called from the top level.");
else
return("CallLevel was called by another function.");
}
document.write(CallLevel());
// Output: CallLevel was called from the top level.函數
functionName 對象是任何正在執行的函數的名稱。spa
caller 屬性只有當函數正在執行時才被定義。 若是函數是從 JavaScript 程序的頂層調用的,則 caller 包含 null。 對象
若是在字符串上下文中使用 caller 屬性,則其結果和 functionName.toString 相同,也就是說,將顯示函數的反編譯文本。ip