Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 1.6 KB

File metadata and controls

27 lines (20 loc) · 1.6 KB
title slug l10n
方法
Glossary/Method
sourceCommit
ada5fa5ef15eadd44b549ecf906423b4a2092f34

{{GlossarySidebar}}

方法是一种作为{{glossary("object","对象")}}的{{glossary("property","属性")}}的{{glossary("function","函数")}}。方法有两种类型:实例方法是由对象实例执行的内置任务,而静态方法是直接在对象构造函数上调用的任务。

Note

在 JavaScript 中,函数本身也是对象,因此,在这个上下文中,方法实际上是对函数的{{glossary("object reference","对象引用")}}。

当说 FO 的一个方法时,通常意味着 FO 作为其 this 绑定。没有根据它们的 this 值具有不同行为的函数属性(或者根本没有动态 this 绑定的函数——比如绑定函数箭头函数)可能不被普遍认为是方法。

参见