funcName.caller : 返回一个对函数的引用, 该函数调用了当前函数
function test() { ???if (test.caller) { ???????var a = test.caller.toString(); ???????????alert(a); ???} else { ???????alert("this is a top function"); ???}}function test2() { ???test();}test(); // this is a top functiontest2(); // 显示函数 test2 的文本
js函数的caller属性
原文地址:http://www.cnblogs.com/upup2015/p/7782631.html