day29 argument 克隆

arguments.callee 打印函数的引用 即自己
function test(){
	console.log(arguments.callee == test);
}
test();

var num = (function (n){
	if( n == 1 || n == 0){
		return 1;
	}
	return n*arguments.callee(n-1);
}(3))

---------------------------------------

func.caller 查询函数自己被哪个环境调用了
function test(){
	demo();
}
function demo(){
	console.log(demo.caller);
}
test();

猜你喜欢

转载自blog.csdn.net/LGT970116/article/details/83119576
今日推荐