arguments.callee ??
//在函數(shù)執(zhí)行時(shí),指向函數(shù)引用
function test ( )?{
? ? ? ? console.log ( arguments.callee) ;?
?????????//?function test ( ) { console.log (arguments.callee) ; ?}
????????console.log ( arguments.callee == test) ; ? //true
}
test ( ) ;
應(yīng)用:
var num = ( function( n ){
? ? ? ? if ( n == 1){ return 1;}
????????return n * arguments.callee( n - 1);
}(20));
function.caller
function test(){
? ? demo();
}
function demo(){
? ? console.log( demo.caller );?
? ?// ?被調(diào)用的環(huán)境 ? function test(){demo();}
}
test();