blob: 54706f64d115f08529493c33b49b35b407a319e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
---
title: Method
slug: Glossary/Method
translation_of: Glossary/Method
---
<p>一个方法就是一个函数,是对象的属性之一。有两种类型的方法:<em>实例方法</em>是由对象实例执行的内置任务,另一种是<em>静态方法</em>,在对象构造函数内直接调用的任务<em>。</em></p>
<div class="note">
<p><strong>注意:</strong> 在 JavaScript 中,函数本身也是对象,因此,在这种情况下,一个方法实际上就是指向一个函数的对象引用。</p>
</div>
<h2 id="Learn_more">Learn more</h2>
<h3 id="Learn_about_it">Learn about it</h3>
<ul>
<li>{{InterWiki("wikipedia","Method (computer programming)")}} in Wikipedia</li>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions">Defining a method in JavaScript</a> (comparison of the traditional syntax and the new shorthand)</li>
</ul>
<h3 id="Technical_reference">Technical reference</h3>
<ul>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Methods_Index">List of JavaScript built-in methods</a></li>
</ul>
<section id="Quick_links">
<ul>
<li><a href="/en-US/docs/Glossary">MDN Web Docs Glossary</a>
<ul>
<li>{{Glossary("function")}}</li>
<li>{{Glossary("object")}}</li>
<li>{{Glossary("property")}}</li>
<li>{{Glossary("static method")}}</li>
</ul>
</li>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions">Defining a method in JavaScript</a></li>
</ul>
</section>
|