I'm creating a simple hang man like game. The user can input a "secret sentence" and then the players have to guess it by chosing letters one by one.
Since this game will be used in several languages, I would like to solve all accented character if a player chose the non-accented character. For example:
IL CANE È BELLO.
If the player choses the vowel "e" only the vowels without accent will be solved (the game compares characters with ===). Instead I would like that the game recognizes automatically all chars accented or not (è, é, e...)
I'm about to torture myself writing a function that checks every accented character, but I was wondering if ther might be an easier way.
This is what my funciton look like so far (I just added the è accented vowel)
function isAccentedVowel(chosenChar, currentChar) {
console.log('The user selected this char: ' + chosenChar)
console.log('I\'m comparing it to this char: ' + currentChar)
switch (chosenChar) {
case 'E':
if (currentChar === 'È') return true;
}
}
note: the secret sentence and every character are uppercase