Created
August 1, 2022 15:33
-
-
Save NyaGarcia/5fab7536ce9500cc168af33bba162fc4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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