diff options
Diffstat (limited to 'files/pl/web/javascript/reference/global_objects/math/sign/index.html')
| -rw-r--r-- | files/pl/web/javascript/reference/global_objects/math/sign/index.html | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/files/pl/web/javascript/reference/global_objects/math/sign/index.html b/files/pl/web/javascript/reference/global_objects/math/sign/index.html new file mode 100644 index 0000000000..bd919f950a --- /dev/null +++ b/files/pl/web/javascript/reference/global_objects/math/sign/index.html @@ -0,0 +1,119 @@ +--- +title: Math.sign() +slug: Web/JavaScript/Reference/Global_Objects/Math/sign +translation_of: Web/JavaScript/Reference/Global_Objects/Math/sign +original_slug: Web/JavaScript/Referencje/Obiekty/Math/sign +--- +<div>{{JSRef("Global_Objects", "Math")}}</div> + +<h2 id="Summary" name="Summary">Podsumowanie</h2> + +<p>Funkcja<strong style="font-weight: bold;"> </strong><code><strong>Math.sign() </strong></code>zwraca znak liczby. Wynik wskazuje czy liczba przekazana jako argument jest dodatnia, ujemna lub czy jest zerem.</p> + +<h2 id="Syntax" name="Syntax">Składnia</h2> + +<pre class="syntaxbox"><code>Math.sign(<em>x</em>)</code></pre> + +<h3 id="Parameters" name="Parameters">Parametry</h3> + +<dl> + <dt><code>x</code></dt> + <dd>Liczba, której znak ma zostać określony.</dd> +</dl> + +<h2 id="Description" name="Description">Opis</h2> + +<p>Metoda <code>sign</code> powinna być zawsze używana jako <code>Math.sign()</code>, ponieważ jest metodą statyczną w obiekcie <code>Math</code>. (Nie jako metoda stworzonego obiektu (<code>Math</code> nie jest konstruktorem)).</p> + +<p>Funkcja ma pięć wartości wynikowych <code>1, -1, 0, -0, NaN,</code> które reprezentują odpowiednio: "liczbę dodatnią", "liczbę ujemną", "zero "dodatnie"", <span style="line-height: 1.572;"> "zero "ujemne"" </span><span style="line-height: 1.572;">oraz NaN (parametr nie jest liczbą).</span></p> + +<p>Argument funkcji jest domyślnie konwertowany do <code>number</code>.</p> + +<h2 id="Examples" name="Examples">Przykłady</h2> + +<h3 id="Example:_Using_Math.log" name="Example:_Using_Math.log">Przykład: Użycie <code>Math.sign</code></h3> + +<pre class="brush:js">Math.sign(3) // 1 +Math.sign(-3) // -1 +Math.sign("-3") // -1 +Math.sign(0) // 0 +Math.sign(-0) // -0 +Math.sign(NaN) // NaN +Math.sign("foo") // NaN +Math.sign() // NaN +</pre> + +<h2 id="Specyfikacje">Specyfikacje</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specyfikacja</th> + <th scope="col">Status</th> + <th scope="col">Komentarz</th> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-math.sign', 'Math.sign')}}</td> + <td>{{Spec2('ES6')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Tabela_zgodności_przeglądarek">Tabela zgodności przeglądarek</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatNo}}</td> + <td>{{CompatGeckoDesktop("25")}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatGeckoMobile("25")}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="See_also" name="See_also">Zobacz również</h2> + +<ul> + <li>Obiekt {{jsxref("Math")}}, który definiuje tą funkcję.</li> +</ul> |
