Skip to content

Instantly share code, notes, and snippets.

@grapho
Forked from poteto/use-pojos-not-switch.js
Created September 24, 2015 21:58
Show Gist options
  • Save grapho/f53dbf4d8b1c9b3fc1e6 to your computer and use it in GitHub Desktop.
Save grapho/f53dbf4d8b1c9b3fc1e6 to your computer and use it in GitHub Desktop.
const MESSAGES = {
400: 'Bad syntax',
404: 'Could not find it',
500: 'You broke the server'
};
function blah(statusCode) {
const msg = MESSAGES[statusCode] || 'idk lol';
doSomethingWith(msg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment