Skip to content

Instantly share code, notes, and snippets.

@ricka
Created March 21, 2020 12:52
Show Gist options
  • Save ricka/78781b3cbc2e0ab1050fff5229cafe46 to your computer and use it in GitHub Desktop.
Save ricka/78781b3cbc2e0ab1050fff5229cafe46 to your computer and use it in GitHub Desktop.
Javascript Switch Alternative
const dogSwitch = (breed) => ({
"border": "Border Collies are good boys and girls.",
"pitbull": "Pit Bulls are good boys and girls.",
"german": "German Shepherds are good boys and girls."
})[breed] || "Default choice";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment