Last active
October 15, 2019 08:32
-
-
Save JaySunSyn/83e26429c097f520cf1eea602c12f875 to your computer and use it in GitHub Desktop.
Example defined checking
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
// DON'T do this | |
function when(expression, trueFn, falseFn) { | |
if (expression) { | |
return trueFn(); | |
} | |
if (falseFn) { | |
return falseFn(); | |
} | |
return undefined; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment