Skip to content

Instantly share code, notes, and snippets.

@viniciusdacal
Created December 1, 2017 17:36
Show Gist options
  • Select an option

  • Save viniciusdacal/ecf05f4c2b85913e6d3c106955cdc81b to your computer and use it in GitHub Desktop.

Select an option

Save viniciusdacal/ecf05f4c2b85913e6d3c106955cdc81b to your computer and use it in GitHub Desktop.
const channelLabel = (channelKey) => {
switch(channelKey) {
case 'tv':
return 'TV/OTT';
case 'youtube':
return 'Youtube';
case 'instagram':
return 'Instagram';
default:
return 'Default value'
}
}
const channelLabel = (channelKey) => {
const channels = {
tv: 'TV/OTT',
youtube: 'Youtube',
instagram: 'Instagram',
};
return channels[channelKey] || 'Default value';
}
@renatobenks-zz

Copy link
Copy Markdown

💯 right approach!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment