Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Created August 1, 2022 15:33
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/5fab7536ce9500cc168af33bba162fc4 to your computer and use it in GitHub Desktop.
Save NyaGarcia/5fab7536ce9500cc168af33bba162fc4 to your computer and use it in GitHub Desktop.
function attackPokemon(enemyType: string) {
if (!enemyType) {
throw new Error('You need to provide an enemy type');
}
if (enemyType === 'fire') {
return useWaterAttack();
}
if (enemyType === 'grass') {
return useFireAttack();
}
useGrassAttack();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment