Skip to content

Instantly share code, notes, and snippets.

@JaySunSyn
Last active October 15, 2019 08:08
Show Gist options
  • Save JaySunSyn/8959f992b68a6f3256abff1239a48001 to your computer and use it in GitHub Desktop.
Save JaySunSyn/8959f992b68a6f3256abff1239a48001 to your computer and use it in GitHub Desktop.
medium-null-example-one-solution
function when(expression, trueFn, falseFn) {
if (expression != null) {
return trueFn();
}
if (falseFn != null) {
return falseFn();
}
return undefined;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment