// 手写 call
Function.prototype.mycall = function(context){
var args = Array.from(arguments)
var obj = args.slice(0,1)[0]
var fn = this
obj.fn = fn
args = args.slice(1)
return obj.fn(args)
}
function fn(){
console.log(this.name)
}
var o = {name : ‘lhx‘}
fn.mycall(o)
相关文章
- 10-24bind,apply,call使用和区别
- 10-24call bind applay 详解
- 10-24ArcEngine10:ArcGIS version not specified. You must call RuntimeManager.Bind before creating any ArcGIS components.
- 10-24Function.prototyoe.call.apply
- 10-24as3 Function 中的call与apply方法
- 10-24apply和call
- 10-24call()与apply() 改变this指向
- 10-24bind,call,apply
- 10-24call()和apply()的作用
- 10-24Call与Apply