javascript apply

function a(){
this.age=15
return this
}
var obj={name:'liuDeHua',sex:'man'}
var c= a.apply(obj)
c
--------------------------------------------------
得到 Object { name="liuDeHua", sex="man", age=15}
==================================================
改代码为
function a(){
this.age=15
return this
}
var obj={name:'liuDeHua',sex:'man'}
var c= a.apply(this,obj)
c
---------------------------------------------------------

c 指向 window,并拥有window的所有属性

==============================================================================


posted on 2013-06-08 20:34  xsSystem  阅读(230)  评论(0编辑  收藏  举报