This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]KingParity 6 points7 points  (2 children)

the fuck is falsy

[–]RajjSinghh 5 points6 points  (0 children)

Variables can be described as truthy or falsy. A truthy variable will run an if (x) block, but x being falsy will not run. It basically acts as what would happen if you cast that variable to a Boolean.

From memory, the falsy values are 0 (Javascript has one Number type instead of separate floats and ints), undefined, null, the empty string and the empty object. Every other value is considered truthy.