aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/javascript/reference/global_objects/function/tosource/index.html
blob: 9f3d32c8b1ff50e711ec3f705319dd94087e8048 (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
---
title: Function.prototype.toSource()
slug: Web/JavaScript/Reference/Global_Objects/Function/toSource
translation_of: Web/JavaScript/Reference/Global_Objects/Function/toSource
original_slug: Web/JavaScript/Referencia/Objetos_globales/Function/toSource
---
<div>{{JSRef}} {{non-standard_header}}</div>

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

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

<pre class="syntaxbox"><code><var>function</var>.toSource();
Function.toSource();
</code></pre>

<h3 id="Parámetros">Parámetros</h3>

<p>Ninguno.</p>

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

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

<ul>
 <li>For the built-in {{jsxref("Function")}} object, <code>toSource()</code> devuelve la siguiente cadena indicando que el código fuente no está disponible:

  <pre class="brush: js">function Function() {
    [native code]
}
</pre>
 </li>
 <li>En funciones personalizadas, <code>toSource()</code> devuelve el código JavaScript que define el objeto como un string.</li>
</ul>

<p>Éste método es usado de forma interna por JavaScript y no explicitamente desde el código. Puedes usar <code>toSource</code> mientras depuras para examinar el contenido de un objeto.</p>

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

<p>No está reflejado en ningún estándar. Implementaso en JavaScript 1.3.</p>

<h2 id="Browser_compatibility">Browser compatibility</h2>

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

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

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