Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Created November 7, 2019 17:38
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/8ff716e8a1aaaaf8718776842165cb19 to your computer and use it in GitHub Desktop.
Save NyaGarcia/8ff716e8a1aaaaf8718776842165cb19 to your computer and use it in GitHub Desktop.
Verbose if else if statement
function attack(pokemon) {
if (pokemon.type === 'water') {
useWaterAttack();
} else if (pokemon.type === 'fire') {
useFireAttack();
} else if (pokemon.type === 'ice') {
useIceAttack();
} else if (pokemon.type === 'electric') {
useElectricAttack();
} else {
usePsychicAttack();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment