1、caller:
function a(){
console.log(a.caller);
}
function b(){
a()
}
b()
执行b函数输出结果:
外部直接执行a函数:
function a(){
console.log(a.caller);
}
function b(){
a()
}
a()
输出结果:
2、callee
b函数调用a函数
function a(){
console.log(arguments.callee);
}
function b(){
a()
}
b()
输出结果:
全局调用a函数
function a(){
console.log(arguments.callee);
}
function b(){
a()
}
a()
输出结果: