DEV Community

loading...

Discussion on: There are 9 falsy values in JavaScript inside of a browser. Can you name them all?

Collapse
pato94 profile image
Cristian Patricio Contreras

What about [], "\t" and "\r", I think those values are falsey too!

Collapse
kennethlum profile image
Kenneth Lum Author

In Google Chrome or in NodeJS:

> !![]
true

> !!"\r"
true

> !!"\t"
true

> !!"\n"
true

> Boolean([])
true

!![] is the same as Boolean([])

In AngularJS some time ago, I remember AngularJS would consider [] to be falsy but in a later version to be truthy: stackoverflow.com/questions/357763...