I practice simple js lessons and have problem with this part below Function should return array index 0 instead of letter A but actually returns - undefined And i cant figure it why ?
function parseGuesses(guess) {
var alphabet = ["A", "B", "C", "D", "E", "F", "G"];
if (guess === null || guess.length !== 2) {
alert("Ups proszę podać literę i cyfrę");
} else { firstChar = guess.charAt(0);
var row = alphabet.indexOf(firstChar);
}
}
console.log(parseGuesses("A2"));
returnkeyword, so nothing will be returned.firstCharshould be declared withvaror preferablylet.