Created
February 11, 2023 11:50
-
-
Save ceving/d177bdf93015c8dd4498542f5cce35b3 to your computer and use it in GitHub Desktop.
JavaScript Limerick: !!(new Boolean(false)) === true
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 coerce_boolean_correctly (arg) { | |
if (arg instanceof Boolean) | |
return coerce_boolean_correctly(arg.valueOf()) | |
return !!arg | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment