call and apply

  • apply()把参数打包成Array再传入;

  • call()把参数按顺序传入。

  • Math.max.apply(null, [3, 5, 4]); // 5
    Math.max.call(null, 3, 5, 4); // 5
  • 对普通函数调用,我们通常把this绑定为null
原文地址:https://www.cnblogs.com/hzx-5/p/9401571.html