Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Created October 8, 2019 17:27
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 NyaGarcia/f3f9b055298880d05616c25eaaf84a1c to your computer and use it in GitHub Desktop.
Save NyaGarcia/f3f9b055298880d05616c25eaaf84a1c to your computer and use it in GitHub Desktop.
function getPokemon(type) {
let pokemon;
switch (type) {
case 'Water':
pokemon = 'Squirtle';
break;
case 'Fire':
pokemon = 'Charmander';
break;
case 'Plant':
pokemon = 'Bulbasur';
break;
case 'Electric':
pokemon = 'Pikachu';
break;
default:
pokemon = 'Mew';
}
return pokemon;
}
console.log(getPokemon('Fire')); // Result: Charmander
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment