diff options
| author | Florian Dieminger <me@fiji-flo.de> | 2021-02-11 18:26:59 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-11 18:26:59 +0100 |
| commit | 7a94b4d8daf297eda6df8e5cf933f7ba159bbc76 (patch) | |
| tree | c8c8a36c41beda7a4c150927b2b5c7d2a09837bd /files/pl/web/javascript/reference/global_objects/function/tostring | |
| parent | ab718192b92d5cc38c1114e055a435a6de7dd8ef (diff) | |
| parent | b8170f78422f2269dfc9df7760cc1ad51c048c00 (diff) | |
| download | translated-content-7a94b4d8daf297eda6df8e5cf933f7ba159bbc76.tar.gz translated-content-7a94b4d8daf297eda6df8e5cf933f7ba159bbc76.tar.bz2 translated-content-7a94b4d8daf297eda6df8e5cf933f7ba159bbc76.zip | |
Merge pull request #38 from fiji-flo/unslugging-pl
Unslugging pl
Diffstat (limited to 'files/pl/web/javascript/reference/global_objects/function/tostring')
| -rw-r--r-- | files/pl/web/javascript/reference/global_objects/function/tostring/index.html | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/files/pl/web/javascript/reference/global_objects/function/tostring/index.html b/files/pl/web/javascript/reference/global_objects/function/tostring/index.html new file mode 100644 index 0000000000..675f65c662 --- /dev/null +++ b/files/pl/web/javascript/reference/global_objects/function/tostring/index.html @@ -0,0 +1,57 @@ +--- +title: Function.prototype.toString() +slug: Web/JavaScript/Reference/Global_Objects/Function/toString +tags: + - Function + - JavaScript + - Method + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Function/toString +original_slug: Web/JavaScript/Referencje/Obiekty/Function/toString +--- +<div>{{JSRef}}</div> + +<h2 id="Podsumowanie" name="Podsumowanie">Podsumowanie</h2> + +<p>Zwraca łańcuch znaków reprezentujący kod źródłowy funkcji.</p> + +<h3 id="Sk.C5.82adnia" name="Sk.C5.82adnia">Składnia</h3> + +<pre class="syntaxbox"><code><var>function</var>.toString(indentation)</code></pre> + +<h3 id="Parametry" name="Parametry">Parametry</h3> + +<dl> + <dt><code>indentation</code> {{non-standard_inline}} {{obsolete_inline(17)}}</dt> + <dd>The amount of spaces to indent the string representation of the source code. If <code>indentation</code> is less than or equal to <code>-1</code>, most unnecessary spaces are removed.</dd> +</dl> + +<h2 id="Opis" name="Opis">Opis</h2> + +<p>Obiekt {{jsxref("Function")}} przesłania metodę {{jsxref("Object.prototype.toString", "toString")}} obiektu {{jsxref("Function")}}; nie dziedziczy {{jsxref("Object.prototype.toString")}}. Dla obiektów <code>Function</code>, metoda <code>toString()</code> zwraca łańcuch znaków reprezentujący obiekt.</p> + +<p>JavaScript wywołuje metodę <code>toString()</code> automatycznie, gdy {{jsxref("Function")}} jest reprezentowana jako wartość tekstowa lub kiedy <code>Function</code> jest odsyłana do połączenia łańcuchów znaków.</p> + +<p>Dla obiektów {{jsxref("Function")}}, wbudowana metoda <code>toString)=</code> dekompiluje funkcję z powrotem do kodu JavaScript, który tę funkcję definiuje. Łańcuch znaków zawiera słowa kluczowe <code>function</code>, listę argumentów, nawiasy klamrowe oraz ciało funkcji.</p> + +<p>Załóżmy na przykład, że masz poniższy kod, który definiuje obiektowy typ <code>Dog</code> i tworzy <code>theDog</code>, obiekt typu <code>Dog</code>:</p> + +<pre class="brush:js">function Dog(name, breed, color, sex) { + this.name = name + this.breed = breed + this.color = color + this.sex = sex +} + +theDog = new Dog( "Gabby", "Lab", "chocolate", "girl" ); +</pre> + +<p>W dowolnej chwili, gdy <code>Dog</code> jest użyty w kontekście jako łańcuch znaków, JavaScript automatycznie wywołuje funkcję <code>toString</code>, która zwraca poniższy łańcuch znaków:</p> + +<pre class="brush: js">function Dog(name, breed, color, sex) { this.name = name; this.breed = breed; this.color = color; this.sex = sex; }</pre> + +<h2 id="Zobacz_tak.C5.BCe" name="Zobacz_tak.C5.BCe">Zobacz także</h2> + +<ul> + <li>{{jsxref("Object.prototype.toString()")}}</li> +</ul> |
