callee
callee 是arguments的一个属性(arguments的另一个属性是length),返回函数的引用
<script>
function test() {
console.log(arguments.callee); // 返回test()函数引用 function test();
}
test();
</script>
caller
返回函数被调用的执行环境
function test() {
demo();
}
function demo() {
console.log(demo.caller); //返回demo被调用的环境 ƒunction test(){demo();}
}
test();
网友评论