Last active
July 9, 2018 17:39
-
-
Save samanthaming/c1c0eb3ce0e4edd2aa5647c64f40f0ea to your computer and use it in GitHub Desktop.
Code Tidbits: #23 No Else Return
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
// β You can skip the else block | |
function hello(name) { | |
if(name) { | |
return 'π' | |
} | |
else { | |
return 'π»' | |
} | |
} | |
// β Yay, much easier to read | |
function hello(name) { | |
if(name) { | |
return 'π' | |
} | |
return 'π»' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment