aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/array/tosource/index.html
blob: 7ff8cff30440f4dea986eb48d27868f457f9068e (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: Array.prototype.toSource()
slug: Web/JavaScript/Reference/Global_Objects/Array/toSource
translation_of: Web/JavaScript/Reference/Global_Objects/Array/toSource
---
<p>{{JSRef("Global_Objects", "Array")}}{{Non-standard_header}}</p>

<h2 id="Summary" name="Summary">概述</h2>

<p>返回一个字符串,代表该数组的源代码.</p>

<h2 id="Syntax" name="Syntax">语法</h2>

<pre class="syntaxbox"><code><em>array</em>.toSource()</code></pre>

<h3 id="Parameters" name="Parameters">参数</h3>

<p></p>

<h2 id="Description" name="Description">描述</h2>

<p>在调试时,你可以使用<code>toSource方法</code>来查看一个数组的内容.</p>

<h2 id="Examples" name="Examples">例子</h2>

<h3 id="Example:_Examining_the_source_code_of_an_array" name="Example:_Examining_the_source_code_of_an_array">例子: 查看数组的源码</h3>

<pre class="brush:js">var alpha = new Array("a", "b", "c");

alpha.toSource();   //返回["a", "b", "c"]</pre>

<h2 id="浏览器兼容性">浏览器兼容性</h2>

<p>{{Compat("javascript.builtins.Array.toSource")}}</p>

<h2 id="See_also" name="See_also">相关链接</h2>

<ul>
 <li><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Array/toString" title="JavaScript/Reference/Global_Objects/Array/toString">Array.toString</a></li>
</ul>