--- title: Truthy slug: Glossary/Truthy translation_of: Glossary/Truthy --- <p>In {{Glossary("JavaScript")}} gilt ein Wert als <strong>truthy</strong>, wenn er in einem {{Glossary("Boolean")}} Kontext evaluiert <code>true</code> ergibt. Alle Werte werden als truthy angesehen, solange sie nicht {{Glossary("Falsy", "falsy")}}, also <code>false</code>, <code>0</code>, <code>""</code>, <code>null</code>, <code>undefined</code> oder <code>NaN</code> sind.</p> <p>JavaScript benutzt {{Glossary("Type_conversion", "Typ-Konversation")}} in Booleschen Kontexten.</p> <h2 id="Beispiele">Beispiele</h2> <p>All diese if-statements werden ausgeführt.</p> <pre class="brush: js">if (true) if ({}) if ([]) if (42) if ("foo") if (new Date()) if (-42) if (3.14) if (-3.14) if (Infinity) if (-Infinity) </pre> <h2 id="Siehe_auch">Siehe auch</h2> <ul> <li>{{Glossary("Falsy")}}</li> <li>{{Glossary("Type_Conversion", "Coercion")}}</li> <li>{{Glossary("Boolean")}}</li> </ul>