-
-
Save aymenbz/7242385632ee86646980a48143d588b8 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