Skip to content

Instantly share code, notes, and snippets.

@Spuffynism
Created May 26, 2020 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Spuffynism/451b519bbf1552dc5a8a72bace4b63c1 to your computer and use it in GitHub Desktop.
Save Spuffynism/451b519bbf1552dc5a8a72bace4b63c1 to your computer and use it in GitHub Desktop.
DON'T DO THIS
// 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