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的所有属性

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


原文地址:https://www.cnblogs.com/xsSystem/p/3127522.html