fn.cal(context,12,3,4,5,); call是直接让函数执行了;
第一个参数是用来改变含数执行的参数
第一个参数是用来改变函数执行时内部this指向的
fn.call(obj,453,324);
fn.call([],24234)
fn.call(1)
Object.prototype.toString.call('')
var a = new f;
console.log(a.toString)
({}).toString()
Object.prototype.toString.call('')//({}).tostring === Object.prototype.tostring
上述 call执行
Function.prtotype.myCall = function (content,...arg) {
constext 就是我让this指向的那个值 arg是要传给对应的实参
this 就是咱么f2
this(..arg) 能实现让f2执行而且把arg中的参数传给 f2
怎么把f2中的this 改为 context ???、
context.eee() eee这个函数中的this 就是context;
content.eee 跟咱们的f2是同一个函数//为了原有的对象中添加属性
var n = Symbol();
context.eee=this;
context.eee(...arg);
delete content.eee;
}复制代码