aboutsummaryrefslogtreecommitdiff
path: root/files/pl/web/javascript/reference/global_objects/math/sqrt/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/pl/web/javascript/reference/global_objects/math/sqrt/index.html')
-rw-r--r--files/pl/web/javascript/reference/global_objects/math/sqrt/index.html47
1 files changed, 47 insertions, 0 deletions
diff --git a/files/pl/web/javascript/reference/global_objects/math/sqrt/index.html b/files/pl/web/javascript/reference/global_objects/math/sqrt/index.html
new file mode 100644
index 0000000000..4622fd2620
--- /dev/null
+++ b/files/pl/web/javascript/reference/global_objects/math/sqrt/index.html
@@ -0,0 +1,47 @@
+---
+title: Math.sqrt()
+slug: Web/JavaScript/Reference/Global_Objects/Math/sqrt
+tags:
+ - JavaScript
+ - Math
+ - Method
+translation_of: Web/JavaScript/Reference/Global_Objects/Math/sqrt
+original_slug: Web/JavaScript/Referencje/Obiekty/Math/sqrt
+---
+<p>{{JSRef}}</p>
+
+<h2 id="Podsumowanie" name="Podsumowanie">Podsumowanie</h2>
+
+<p>Zwraca pierwiastek kwadratowy danej liczby.</p>
+
+<p><math display="block"><semantics><mrow><mo>∀</mo><mi>x</mi><mo>≥</mo><mn>0</mn><mo>,</mo><mstyle mathvariant="monospace"><mrow><mi>M</mi><mi>a</mi><mi>t</mi><mi>h</mi><mo>.</mo><mi>s</mi><mi>q</mi><mi>r</mi><mi>t</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow></mstyle><mo>=</mo><msqrt><mi>x</mi></msqrt><mo>=</mo><mtext>the unique</mtext><mspace width="thickmathspace"></mspace><mi>y</mi><mo>≥</mo><mn>0</mn><mspace width="thickmathspace"></mspace><mtext>such that</mtext><mspace width="thickmathspace"></mspace><msup><mi>y</mi><mn>2</mn></msup><mo>=</mo><mi>x</mi></mrow><annotation encoding="TeX">\forall x \geq 0, \mathtt{Math.sqrt(x)} = \sqrt{x} = \text{the unique} \; y \geq 0 \; \text{such that} \; y^2 = x</annotation></semantics></math></p>
+
+<h2 id="Sk.C5.82adnia" name="Sk.C5.82adnia">Składnia</h2>
+
+<pre class="syntaxbox"><code>Math.sqrt(<var>x</var>)</code></pre>
+
+<h3 id="Parametry" name="Parametry">Parametry</h3>
+
+<dl>
+ <dt><code>x</code> </dt>
+ <dd>liczba.</dd>
+</dl>
+
+<h2 id="Opis" name="Opis">Opis</h2>
+
+<p>Jeśli wartość <code>x</code> jest ujemna, funkcja <code>sqrt</code> zwraca {{jsxref("NaN")}}.</p>
+
+<p>Ponieważ <code>sqrt()</code> jest statyczną metodą obiektu {{jsxref("Math")}}, zawsze odwołujemy się do niej poprzez <code>Math.sqrt()</code>, a nie jak do metody instancji obiektu {{jsxref("Math")}} utworzonej przez użytkownika.</p>
+
+<h2 id="Przyk.C5.82ady" name="Przyk.C5.82ady">Przykłady</h2>
+
+<h3 id="Przyk.C5.82ad:_Zastosowanie_Math.sqrt" name="Przyk.C5.82ad:_Zastosowanie_Math.sqrt">Przykład: Zastosowanie <code>Math.sqrt()</code></h3>
+
+<pre class="brush: js language-js"><code class="language-js">Math<span class="token punctuation">.</span><span class="token function">sqrt<span class="token punctuation">(</span></span><span class="token number">9</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment"> // 3
+</span>Math<span class="token punctuation">.</span><span class="token function">sqrt<span class="token punctuation">(</span></span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment"> // 1.414213562373095
+</span>
+Math<span class="token punctuation">.</span><span class="token function">sqrt<span class="token punctuation">(</span></span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment"> // 1
+</span>Math<span class="token punctuation">.</span><span class="token function">sqrt<span class="token punctuation">(</span></span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment"> // 0
+</span>Math<span class="token punctuation">.</span><span class="token function">sqrt<span class="token punctuation">(</span></span><span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment"> // NaN</span></code></pre>
+
+<p> </p>