call() 和 apply() 之间的区别.docxVIP

  • 2
  • 0
  • 约1.09千字
  • 约 5页
  • 2022-03-31 发布于广东
  • 举报
第 第 PAGE 1 页 共 NUMPAGES 1 页 call() 和 apply() 之间的区别 不同之处是: call() 办法分离接受参数。 apply() 办法接受数组形式的参数。 假如要用法数组而不是参数列表,则 apply() 办法十分便利。 带参数的 apply() 办法 apply() 办法接受数组中的参数: 实例 var person = { fullName: function(city, country) { return this.firstName + quot; quot; + this.lastName + quot;,quot; + city + quot;,quot; + country; } } var person1 = { firstName:quot;Johnquot;, lastName: quot;Doequot; } person.fullName.apply(person1, [quot;Osloquot;, quot;Norway

文档评论(0)

1亿VIP精品文档

相关文档