aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/javascript/reference/global_objects/array/tosource/index.html
blob: 252967e8d7673492cc757d18f03c627364f8cab1 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
title: Array.prototype.toSource()
slug: Web/JavaScript/Reference/Global_Objects/Array/toSource
translation_of: Web/JavaScript/Reference/Global_Objects/Array/toSource
original_slug: Web/JavaScript/Referencia/Objetos_globales/Array/toSource
---
<div>{{JSRef}} {{non-standard_header}}</div>

<p>El método <code><strong>toSource()</strong></code> devuelve un string representando el código fuente de un arreglo.</p>

<h2 id="Sintaxis">Sintaxis</h2>

<pre class="syntaxbox"><var>arr</var>.toSource()</pre>

<h3 id="Valor_devuelto">Valor devuelto</h3>

<p>Un string representando el código fuente del arreglo.</p>

<h2 id="Descripción">Descripción</h2>

<p>El método <code>toSource</code>r retorna los siguientes valores:</p>

<ul>
 <li>Para el objeto global {{jsxref("Array")}}, <code>toSource</code> devuelve el siguiente string indicando que el código fuente no está disponible:

  <pre class="brush: js">function Array() {
    [native code]
}
</pre>
 </li>
 <li>Para instancias de {{jsxref("Array")}}, <code>toSource</code> devuelve un string representando el código fuente.</li>
</ul>

<p>Este método suele ser llamado internamente por JavaScript y no explícitamente en código. Puede usar <code>toSource</code> mientras depura para examinar el contenido de un arreglo.</p>

<h2 id="Ejemplos">Ejemplos</h2>

<h3 id="Examinar_el_código_fuente_de_un_arreglo">Examinar el código fuente de un arreglo</h3>

<p>Para examinar el código fuente de un arreglo:</p>

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

alpha.toSource();
//devuelve ['a', 'b', 'c']
</pre>

<h2 id="Especificaciones">Especificaciones</h2>

<p>No hace parte de ningún estándar. Implementado en JavaScript 1.3.</p>

<h2 id="Compatibilidad_con_navegadores">Compatibilidad con navegadores</h2>

{{Compat("javascript.builtins.Array.toSource")}}

<h2 id="Ver_también">Ver también</h2>

<ul>
 <li>{{jsxref("Object.prototype.toSource()")}}</li>
 <li>{{jsxref("Array.prototype.toString()")}}</li>
</ul>