var time = 3 //控制次数,去掉会一直在caller与handleCaller交替不断执行
function caller() {
caller.caller()//返回调用caller函数的函数引用
}
function handleCaller() {
if (time > 0){
time--
alert(handleCaller.caller)//返回调用handleCaller函数的函数引用
alert(caller.caller)//返回调用caller函数的函数引用
caller()
}
}
handleCaller()
====================
function testCaller(){
if(testCaller.caller == null){
console.log('accessed at global');
}else{
console.log('accessed at ' + testCaller.caller);
}
}
testCaller(); // accessed at global
function a(){
testCaller();
}
a(); // accessed at function a(){testCaller();}
function a(){
alert(arguments.callee)
var args = arguments
function c(){
alert(arguments.callee)
args.callee()
}
c()
}
a()
====================
function a(x){
if(x<=1)
return x;
else
return x + a(x-1);
}
a(12) // 78
var b = a; a = null; // 将a回收 b(12); // erro : 'a' is not a function
function a(x){
if(x<=1)
return x;
else
return arguments.callee(x-1); // 这句是改变的地方
}
var b = a; a = null; b(12); // 78
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有