aboutsummaryrefslogtreecommitdiff
path: root/files/pl/web/javascript/referencje/obiekty/error/tostring/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/pl/web/javascript/referencje/obiekty/error/tostring/index.html')
-rw-r--r--files/pl/web/javascript/referencje/obiekty/error/tostring/index.html98
1 files changed, 0 insertions, 98 deletions
diff --git a/files/pl/web/javascript/referencje/obiekty/error/tostring/index.html b/files/pl/web/javascript/referencje/obiekty/error/tostring/index.html
deleted file mode 100644
index 6b019bc60b..0000000000
--- a/files/pl/web/javascript/referencje/obiekty/error/tostring/index.html
+++ /dev/null
@@ -1,98 +0,0 @@
----
-title: Error.prototype.toString()
-slug: Web/JavaScript/Referencje/Obiekty/Error/toString
-tags:
- - JavaScript
- - Metodă
- - Prototype
-translation_of: Web/JavaScript/Reference/Global_Objects/Error/toString
----
-<div>{{JSRef}}</div>
-
-<p>Metoda <code><strong>toString()</strong></code> zwraca iąg znaków reprezentujący dany obiekt {{jsxref("Error")}}.</p>
-
-<h2 id="Składnia">Składnia</h2>
-
-<pre class="syntaxbox notranslate"><code><var>e</var>.toString()</code></pre>
-
-<h3 id="Zwracana_wartość">Zwracana wartość</h3>
-
-<p>Ciąg znaków reprezentujący dany obiekt {{jsxref("Error")}}.</p>
-
-<h2 id="Opis">Opis</h2>
-
-<p>Obiekt {{jsxref("Error")}} nadpisuje metodę {{jsxref("Object.prototype.toString()")}} dziedziczoną przez wszystkie obiekty. Jego semantyka jest następująca (przy założeniu, że {{jsxref("Object")}} i {{jsxref("String")}} mają swoje oryginalne wartości):</p>
-
-<pre class="brush: js notranslate">Error.prototype.toString = function() {
- 'use strict';
-
- var obj = Object(this);
- if (obj !== this) {
- throw new TypeError();
- }
-
- var name = this.name;
- name = (name === undefined) ? 'Error' : String(name);
-
- var msg = this.message;
- msg = (msg === undefined) ? '' : String(msg);
-
- if (name === '') {
- return msg;
- }
- if (msg === '') {
- return name;
- }
-
- return name + ': ' + msg;
-};
-</pre>
-
-<h2 id="Przykłady">Przykłady</h2>
-
-<h3 id="Użycie_toString">Użycie toString()</h3>
-
-<pre class="brush: js notranslate">var e = new Error('fatal error');
-console.log(e.toString()); // 'Error: fatal error'
-
-e.name = undefined;
-console.log(e.toString()); // 'Error: fatal error'
-
-e.name = '';
-console.log(e.toString()); // 'fatal error'
-
-e.message = undefined;
-console.log(e.toString()); // ''
-
-e.name = 'hello';
-console.log(e.toString()); // 'hello'
-</pre>
-
-<h2 id="Specyfikacje">Specyfikacje</h2>
-
-<table class="standard-table">
- <thead>
- <tr>
- <th scope="col">Specyfikacja</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>{{SpecName('ESDraft', '#sec-error.prototype.tostring', 'Error.prototype.toString')}}</td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Wsparcie_przeglądarek">Wsparcie przeglądarek</h2>
-
-<div>
-
-
-<p>{{Compat("javascript.builtins.Error.toString")}}</p>
-</div>
-
-<h2 id="Zobacz_też">Zobacz też</h2>
-
-<ul>
- <li>{{jsxref("Error.prototype.toSource()")}}</li>
-</ul>