首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

函数的持有人和调用者

2012-11-03 
函数的所有者和调用者arguments.callee 返回当前运行的函数arguments.callee.length 形参arguments.length

函数的所有者和调用者
arguments.callee 返回当前运行的函数

arguments.callee.length 形参
arguments.length 实参

*.caller 返回当前函数的上下文也就是函数调用者


function test(){
alert(arguments.callee.length)// 0
alert(arguments.length) //1
alert(arguments.callee);//  就是这个函数
alert(test.caller); // a
}


function a(){
   test("sss");
}

a();

函数的所有者,也就是this代表的对象
1,一般情况 o.function( this 这里的this就是指o)
2,function.call(o)
           apply(o) 让o去调用function 所有o也就是所有者








热点排行