diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/function/tosource/index.html')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/function/tosource/index.html | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/tosource/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/tosource/index.html new file mode 100644 index 0000000000..5c4de38138 --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/function/tosource/index.html @@ -0,0 +1,49 @@ +--- +title: Function.prototype.toSource() +slug: Web/JavaScript/Reference/Global_Objects/Function/toSource +translation_of: Web/JavaScript/Reference/Global_Objects/Function/toSource +--- +<div> +<div>{{JSRef("Global_Objects", "Function")}} {{non-standard_header}}</div> +</div> + +<h2 id="Summary" name="Summary">概述</h2> + +<p>返回函数的源代码的字符串表示.</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="syntaxbox"><code><var>function</var>.toSource(); +Function.toSource(); +</code></pre> + +<h3 id="Parameters" name="Parameters">参数</h3> + +<p>无</p> + +<h2 id="Description" name="Description">描述</h2> + +<p><code>toSource方法返回下面的值</code>:</p> + +<p></p> + +<ul> + <li>对于内置的<code>Function</code>对象,<code>toSource</code>返回下面的字符串:</li> +</ul> + +<pre class="brush: js"><code>function Function() { + [native code] +}</code></pre> + +<ul> + <li>对于自定义函数来说, <code>toSource返回能定义该函数</code>的Javascript源码.</li> +</ul> + +<p>该方法通常在引擎内部调用.你可以在调试的时候用该方法开查看一个函数的源代码.</p> + +<h2 id="See_Also" name="See_Also">相关链接</h2> + +<ul> + <li><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Function/toString" title="JavaScript/Reference/Global_Objects/Function/toString">toString</a></li> + <li><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Object/valueOf" title="JavaScript/Reference/Global_Objects/Object/valueOf">Object.prototype.valueOf</a></li> +</ul> |