Skip to content

Instantly share code, notes, and snippets.

@grosscorporation
Created June 29, 2020 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grosscorporation/4d9f3f590c6be842047dbf9ee3e7dd6f to your computer and use it in GitHub Desktop.
Save grosscorporation/4d9f3f590c6be842047dbf9ee3e7dd6f to your computer and use it in GitHub Desktop.
JavaScript Truthy and Falsey
function falsey( val ) {
return !(
val === 'undefined' ||
val === undefined ||
val === false ||
val === "false" ||
val === "off" ||
val === "OFF" ||
val === "Off" ||
val === null ||
val === 'null' ||
val === 'NaN' ||
val === NaN ||
val === 0 ||
val === "0" ||
val === '')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment