Skip to content

Instantly share code, notes, and snippets.

@tevashov
Last active October 27, 2022 21:53
Show Gist options
  • Select an option

  • Save tevashov/5172443 to your computer and use it in GitHub Desktop.

Select an option

Save tevashov/5172443 to your computer and use it in GitHub Desktop.
How to: TRUE and FALSE evaluating #JS
// TRUE
'0';
'any string';
[]; // an empty array
{}; // an empty object
1; // any non-zero number
// FALSE
0;
''; // an empty string
NaN; // JavaScript's "not-a-number" variable
null;
undefined; // be careful -- undefined can be redefined!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment