diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/ru/словарь/truthy/index.html | |
parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip |
initial commit
Diffstat (limited to 'files/ru/словарь/truthy/index.html')
-rw-r--r-- | files/ru/словарь/truthy/index.html | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/files/ru/словарь/truthy/index.html b/files/ru/словарь/truthy/index.html new file mode 100644 index 0000000000..a99cf53cf9 --- /dev/null +++ b/files/ru/словарь/truthy/index.html @@ -0,0 +1,39 @@ +--- +title: Truthy +slug: Словарь/Truthy +tags: + - Glossary + - JavaScript + - truthy + - Словарь +translation_of: Glossary/Truthy +--- +<p>В {{Glossary("JavaScript")}}, <strong>истинное</strong> значение - это значение, которое считается <code>true</code>, когда встречается в контексте {{Glossary("Boolean")}}. Все значения истинные, если они не определены как {{Glossary("Falsy", "falsy")}} (кроме <code>false</code>, <code>0</code>, <code>-0</code>, <code>0n</code>, <code>""</code>, <code>null</code>, <code>undefined</code>, и <code>NaN</code>).</p> + +<p>{{Glossary("JavaScript")}} использует {{Glossary("Type_coercion", "приведение типов")}} в Boolean контекстах.</p> + +<p>Примеры истинных значений в JavaScript (которые будут приведены к true в булевых выражениях, и таким образом выполниться блок if):</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> + +<ul> + <li>{{Glossary("Falsy")}}</li> + <li>{{Glossary("Type_Conversion", "Coercion")}}</li> + <li>{{Glossary("Boolean")}}</li> +</ul> + +<div>{{QuickLinksWithSubpages("/en-US/docs/Glossary")}}</div> |