call的理解

调用一个对象的一个方法,以另一个对象替换当前对象。

<script>
function f(strArguments) {
  console.log(this);
  this.name = strArguments;
}

function A(value) {
  f.call(this, value);
}

var a = new A("test");
alert(a.name);

</script>
原文地址:https://www.cnblogs.com/heqhbk/p/4259125.html