js apply与call的用法与区别

apply和call

function Person(c, d) {

  return this.a + this.b + c + d 

}

var  o = {a: 1, b: 2}

Person.call(o, 3, 4) 或者 Person.apoly(o, [3, 4]),  o是你想作为Person函数里面this的对象 ,结果都是10

原文地址:https://www.cnblogs.com/zph666/p/9321646.html