Skip to content

Instantly share code, notes, and snippets.

@d1i1m1o1n
Created February 27, 2021 10:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save d1i1m1o1n/d2a5391f09a1834597991d5793a3307c to your computer and use it in GitHub Desktop.
Alternative to switch case
const page = 'edit';
const content = {
create: () => console.log('create'),
edit: () => console.log('edit'),
view: () => console.log('view')
}[page]()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment