Skip to content

Instantly share code, notes, and snippets.

@krhoyt
Created July 17, 2018 19:54
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 krhoyt/34b635a84d58f6e8329dd12febec1273 to your computer and use it in GitHub Desktop.
Save krhoyt/34b635a84d58f6e8329dd12febec1273 to your computer and use it in GitHub Desktop.
Interesting alternative decision structure using ES6.
let foo = ( {
a: () => { return 'a'; },
b: () => { return myFunction; }
} )[bar] || 3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment