Created
June 29, 2020 00:17
-
-
Save grosscorporation/4d9f3f590c6be842047dbf9ee3e7dd6f to your computer and use it in GitHub Desktop.
JavaScript Truthy and Falsey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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