From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/glossary/truthy/index.html | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 files/ja/glossary/truthy/index.html (limited to 'files/ja/glossary/truthy') diff --git a/files/ja/glossary/truthy/index.html b/files/ja/glossary/truthy/index.html new file mode 100644 index 0000000000..3d62da159f --- /dev/null +++ b/files/ja/glossary/truthy/index.html @@ -0,0 +1,55 @@ +--- +title: Truthy +slug: Glossary/Truthy +tags: + - CodingScripting + - Glossary + - JavaScript + - 用語集 +translation_of: Glossary/Truthy +--- +

{{Glossary("JavaScript")}} において、 truthy は {{Glossary("Boolean")}} コンテキストに現れた時に true とみなされる値のことです。 {{Glossary("Falsy", "falsy")}} として定義された値 (つまり、false, 0, -0, 0n, "", null, undefined, NaN) を除くすべての値は truthy です。

+ +

{{Glossary("JavaScript")}} は、 Boolean コンテキストでは{{Glossary("Type_Conversion", "型変換")}}を用います。

+ +

JavaScript で truthy な値の例です (boolean コンテキストではこれらの値を true と評価し、if ブロックを実行します)。

+ +
if (true)
+if ({})
+if ([])
+if (42)
+if ("0")
+if ("false")
+if (new Date())
+if (-42)
+if (12n)
+if (3.14)
+if (-3.14)
+if (Infinity)
+if (-Infinity)
+
+ +

仕様書

+ + + + + + + + + + + + +
仕様書
{{SpecName("ESDraft", "#sec-toboolean", "ToBoolean abstract operation")}}
+ +

関連情報

+ + + +
{{QuickLinksWithSubpages("/ja/docs/Glossary")}}
-- cgit v1.2.3-54-g00ecf