Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Unsere Freiwilligen haben diesen Artikel noch nicht in Deutsch übersetzt. Machen Sie mit und helfen Sie, das zu erledigen!

A falsy value is a value that translates to false when evaluated in a Boolean context.

JavaScript uses type coercion in Boolean contexts.

Examples

Examples of falsy values in JavaScript (which translate to false and thus bypass the if block):

if (false)
if (null)
if (undefined)
if (0)
if (NaN)
if ('')
if ("")
if (document.all) [1]

[1] document.all has been used for browser detection in the past and the HTML specification defines a willful violation of the ECMAScript standard here to keep compatibility with legacy code (if (document.all) { // Internet Explorer code here } or using document.all without checking its presence first: document.all.foo).

Sometimes written falsey, although in English usually turning a word into an adjective with a -y, any final e is dropped (noise => noisy, ice => icy, shine => shiny)

Learn more

Schlagwörter des Dokuments und Mitwirkende

 Mitwirkende an dieser Seite: Sheppy, chinhodado, tjcrowder, Andrew_Pfeiffer, hbloomer, klez, fscholz
 Zuletzt aktualisiert von: Sheppy,