DEV Community

Discussion on: JavaScript Quiz

Collapse
 
eljayadobe profile image
Eljay-Adobe

One of my favorite web-slinger questions (for fun, not for job interviews) is: can you name all 8 of the falsy things?

Here's the first falsy thing, to get you started, which is pretty much a gimme:

  • false
Collapse
 
caseywebb profile image
Casey Webb • Edited
false
null
0
undefined
""
NaN

I'm out. What are the last 2?

Collapse
 
kenbellows profile image
Ken Bellows

-NaN and -0

Collapse
 
joshcheek profile image
Josh Cheek

Shoutout! I didn't get NaN

Collapse
 
eljayadobe profile image
Eljay-Adobe

Here they all are. I realize that two of them will bring out the angry mob with their torches and pitchforks. But my disclaimer is that I did not write the language.

First the easy 6 falsy things:

  • false
  • 0
  • ""
  • undefined
  • null
  • NaN

Plus the final two falsy things, the second of which being an HTML-ism (part of the HTML specification):

  • -0
  • document.all