diff options
Diffstat (limited to 'files/de/web/javascript/reference/global_objects/function/tosource')
-rw-r--r-- | files/de/web/javascript/reference/global_objects/function/tosource/index.html | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/files/de/web/javascript/reference/global_objects/function/tosource/index.html b/files/de/web/javascript/reference/global_objects/function/tosource/index.html new file mode 100644 index 0000000000..75552bdc8c --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/function/tosource/index.html @@ -0,0 +1,72 @@ +--- +title: Function.prototype.toSource() +slug: Web/JavaScript/Reference/Global_Objects/Function/toSource +tags: + - Function + - JavaScript + - Method +translation_of: Web/JavaScript/Reference/Global_Objects/Function/toSource +--- +<div>{{JSRef}} {{non-standard_header}}</div> + +<p>Die <code><strong>toSource()</strong></code> Methode gibt eine Stringrepräsentation des Quelltextes des Objektes zurück.</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><var>function</var>.toSource(); +Function.toSource(); +</pre> + +<h3 id="Rückgabewert">Rückgabewert</h3> + +<p>Eine Stringrepräsentation des Quelltextes des Objektes.</p> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Die <code>toSource</code> Methode gibt die folgenden Werte zurück:</p> + +<ul> + <li>Für das eingebaute {{jsxref("Function")}} Objekt gibt <code>toSource()</code> den folgenden String zurück, der angibt, dass der Quelltext nicht verfügbar ist: + + <pre class="brush: js">function Function() { + [native code] +} +</pre> + </li> + <li>Für Benutzerdefinierte Funktionen, gibt <code>toSource()</code> den JavaScript Quelltext zurück, welcher das Objekt als String definiert.</li> + <li> + <pre class="brush: js">// Zum Beispiel: +function hello() { + console.log("Hello, World!"); +} + +hello.toSource();</pre> + </li> + <li> + <pre class="brush: js">// Das Resultat +"function hello() { + console.log(\"Hello, World!\"); +}" +</pre> + </li> +</ul> + +<p>Die Methode wird normalerweise von JavaScript selbst aufgerufen und nicht explizit im Quelltext. Man kann <code>toSource</code> während des Debuggens aufrufen, um zu ermitteln, was ein Objekt enthält.</p> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<p>Ist in keinem Standard. Implementiert in JavaScript 1.3.</p> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Function.toSource")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("Object.prototype.toSource()")}}</li> +</ul> |