Created
November 18, 2021 20:36
-
-
Save n8rzz/acba7593f83e67c046339349af7ea1a6 to your computer and use it in GitHub Desktop.
exclusive-if.ts
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
// bad | |
function displayName(name) { | |
if (name) { | |
return name; | |
} | |
return ''; | |
} | |
// good | |
function displayName(name) { | |
if (!name) { | |
return ''; | |
} | |
return name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment