From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/pt-br/glossario/truthy/index.html | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 files/pt-br/glossario/truthy/index.html (limited to 'files/pt-br/glossario/truthy') diff --git a/files/pt-br/glossario/truthy/index.html b/files/pt-br/glossario/truthy/index.html new file mode 100644 index 0000000000..872e53df91 --- /dev/null +++ b/files/pt-br/glossario/truthy/index.html @@ -0,0 +1,34 @@ +--- +title: Truthy +slug: Glossario/Truthy +tags: + - CodingScripting + - Glossário + - JavaScript +translation_of: Glossary/Truthy +--- +

Em {{Glossary("JavaScript")}}, um valor truthy é um valor que se traduz em verdadeiro quando avaliado em um contexto {{Glossary("Booleano")}}. Todos os valores são truthy a menos que eles sejam definidos como {{Glossary("Falsy", "falsy")}} (ou seja., exceto para false, 0, "", null, undefined, e NaN).

+ +

O {{Glossary("JavaScript")}} usa {{Glossary("Type_Conversion", "coerção")}} de tipo em contextos booleanos.

+ +

Exemplos de valores truthy em JavaScript (que se traduzirão em true, e então executar o bloco if):

+ +
if (true)
+if ({})
+if ([])
+if (42)
+if ("foo")
+if (new Date())
+if (-42)
+if (3.14)
+if (-3.14)
+if (Infinity)
+if (-Infinity)
+ +

Veja também

+ + -- cgit v1.2.3-54-g00ecf