Created
May 26, 2020 22:29
-
-
Save Spuffynism/451b519bbf1552dc5a8a72bace4b63c1 to your computer and use it in GitHub Desktop.
DON'T DO THIS
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
// Fun fact! Returning if conditional statements can be done in js as well as in rust by using IIFEs! | |
const fn = (x) => { | |
return (() => {if (x == 0) { return 'zero'; } else if (x < 0) { return 'negative' } else { return 'positive'; }})(); | |
}; | |
fn(1) | |
// positive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment