diff options
author | Florian Merz <me@fiji-flo.de> | 2021-02-11 14:49:24 +0100 |
---|---|---|
committer | Florian Merz <me@fiji-flo.de> | 2021-02-11 14:49:24 +0100 |
commit | de5c456ebded0e038adbf23db34cc290c8829180 (patch) | |
tree | 2819c07a177bb7ec5f419f3f6a14270d6bcd7fda /files/pl/web/javascript/referencje/obiekty/number/isnan/index.html | |
parent | 8260a606c143e6b55a467edf017a56bdcd6cba7e (diff) | |
download | translated-content-de5c456ebded0e038adbf23db34cc290c8829180.tar.gz translated-content-de5c456ebded0e038adbf23db34cc290c8829180.tar.bz2 translated-content-de5c456ebded0e038adbf23db34cc290c8829180.zip |
unslug pl: move
Diffstat (limited to 'files/pl/web/javascript/referencje/obiekty/number/isnan/index.html')
-rw-r--r-- | files/pl/web/javascript/referencje/obiekty/number/isnan/index.html | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/files/pl/web/javascript/referencje/obiekty/number/isnan/index.html b/files/pl/web/javascript/referencje/obiekty/number/isnan/index.html deleted file mode 100644 index ddb723b409..0000000000 --- a/files/pl/web/javascript/referencje/obiekty/number/isnan/index.html +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: Number.isNaN() -slug: Web/JavaScript/Referencje/Obiekty/Number/isNaN -tags: - - ECMAScript 2015 - - JavaScript - - Metodă - - NaN - - Number - - isNaN -translation_of: Web/JavaScript/Reference/Global_Objects/Number/isNaN ---- -<div>{{JSRef}}</div> - -<p>Metoda <strong><code>Number.isNaN()</code></strong> określa czy podany parametr ma wartość {{jsxref("NaN")}} i czy jest typu {{jsxref("Number")}}. Jest to ulepszona wersja oryginalnej, globalne funkcji {{jsxref("isNaN", "isNaN()")}}.</p> - -<div>{{EmbedInteractiveExample("pages/js/number-isnan.html", "taller")}}</div> - -<div class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> and send us a pull request.</div> - -<h2 id="Składnia">Składnia</h2> - -<pre class="syntaxbox"><code>Number.isNaN(<var>value</var>)</code></pre> - -<h3 id="Parametry">Parametry</h3> - -<dl> - <dt><code><var>value</var></code></dt> - <dd>Wartość, którą będziemy testować {{jsxref("NaN")}}.</dd> -</dl> - -<h3 id="Zwracana_wartość">Zwracana wartość</h3> - -<p><strong>true</strong>, jeśli podana wartość jest {{jsxref("NaN")}}, a jej typem jest {{jsxref("Number")}}; w przeciwnym razie, <strong>false</strong>.</p> - -<h2 id="Opis">Opis</h2> - -<p>Ponieważ oba operatory porównania, {{jsxref("Operators/Comparison_Operators", "==", "#Equality")}} i {{jsxref("Operators/Comparison_Operators", "===", "#Identity")}}, dla zapytania czy {{jsxref("NaN")}} <em>jest równe</em> {{jsxref("NaN")}} zwracają <code>false</code> funkcja <code>Number.isNaN()</code> staje się niezbędna. Jest sytuacja wyjątkowa i nie występuje, gdy porównujemy dowolne inne wartości w języku JavaScript.</p> - -<p>W porównaniu do funkcji globalnej {{jsxref("isNaN", "isNaN()")}}, metoda <code>Number.isNaN()</code> nie ma problemu z usilnym konwertowaniem parametru na liczbę. To oznacza, że można bezpiecznie przekazywać wartości, które normalnie mogłyby zostać skonwertowane na {{jsxref("NaN")}}, ale nie mają tej samej wartości co {{jsxref("NaN")}}. To również oznacza, że jedynie wartości typu {{jsxref("Number")}}, które są również {{jsxref("NaN")}}, zwrócą <code>true</code>.</p> - -<h2 id="Przykłady">Przykłady</h2> - -<pre class="brush: js">Number.isNaN(NaN); // true -Number.isNaN(Number.NaN); // true -Number.isNaN(0 / 0); // true - -// Gdybyśmy użyli funkcji isNaN(), te przykłady zwróciłby true -Number.isNaN('NaN'); // false -Number.isNaN(undefined); // false -Number.isNaN({}); // false -Number.isNaN('blabla'); // false - -// Wszystkie zwracają false -Number.isNaN(true); -Number.isNaN(null); -Number.isNaN(37); -Number.isNaN('37'); -Number.isNaN('37.37'); -Number.isNaN(''); -Number.isNaN(' '); -</pre> - -<h2 id="Polyfill">Polyfill</h2> - -<p>Następujący przykład działa, ponieważ {{jsxref("NaN")}} jest jedyną wartością w języku JavaScript, która nie jest równa samej sobie.</p> - -<pre class="brush: js">Number.isNaN = Number.isNaN || function(value) { - return value !== null && (value != value || +value != value); -} -</pre> - -<h2 id="Opis_2">Opis</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('ESDraft', '#sec-number.isnan', 'Number.isnan')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td></td> - </tr> - <tr> - <td>{{SpecName('ES2015', '#sec-number.isnan', 'Number.isnan')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td>Initial definition.</td> - </tr> - </tbody> -</table> - -<h2 id="Kompatybilność">Kompatybilność</h2> - - - -<div>{{Compat("javascript.builtins.Number.isNaN")}}</div> - -<h2 id="Zobacz_również">Zobacz również</h2> - -<ul> - <li>{{jsxref("Number")}}</li> - <li>{{jsxref("isNaN", "isNaN()")}}</li> -</ul> |