aboutsummaryrefslogtreecommitdiff
path: root/files/uk/glossary/truthy/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/uk/glossary/truthy/index.html')
-rw-r--r--files/uk/glossary/truthy/index.html52
1 files changed, 52 insertions, 0 deletions
diff --git a/files/uk/glossary/truthy/index.html b/files/uk/glossary/truthy/index.html
new file mode 100644
index 0000000000..a89d30a922
--- /dev/null
+++ b/files/uk/glossary/truthy/index.html
@@ -0,0 +1,52 @@
+---
+title: Truthy
+slug: Glossary/Truthy
+tags:
+ - JavaScript
+ - Словник
+translation_of: Glossary/Truthy
+---
+<p><span class="seoSummary">У мові {{Glossary("JavaScript")}}, <strong>правдиве (truthy) </strong>значення - це значення, яке дорівнює <code>true</code> у контексті {{Glossary("Boolean")}}. Всі величини є правдивими, крім тих, які визначені як {{Glossary("Falsy", "хибні")}} (тобто, крім <code>false</code>, <code>0</code>, <code>-0</code>, <code>0n</code>, <code>""</code>, <code>null</code>, <code>undefined</code> та <code>NaN</code>).</span></p>
+
+<p>Мова {{Glossary("JavaScript")}} використовує неявне {{Glossary("Type_Conversion", "перетворення типів")}} у контексті Boolean.</p>
+
+<p>Приклади <em>правдивих </em>значень у JavaScript (які будуть неявно приведені до true у контексті boolean, і, таким чином, виконають блок <code>if</code>):</p>
+
+<pre class="brush: js notranslate">if (true)
+if ({})
+if ([])
+if (42)
+if ("0")
+if (new Date())
+if (-42)
+if (12n)
+if (3.14)
+if (-3.14)
+if (Infinity)
+if (-Infinity)
+</pre>
+
+<h2 id="Специфікації">Специфікації</h2>
+
+<table>
+ <thead>
+ <tr>
+ <th scope="col"><strong>Специфікація</strong></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName("ESDraft", "#sec-toboolean", "<code>ToBoolean</code> abstract operation")}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Див._також">Див. також</h2>
+
+<ul>
+ <li>{{Glossary("Falsy")}}</li>
+ <li>{{Glossary("Type_Conversion", "Приведення")}}</li>
+ <li>{{Glossary("Boolean")}}</li>
+</ul>
+
+<div>{{QuickLinksWithSubpages("/uk/docs/Glossary")}}</div>