Function to map letters to numbers
Why not just compare directly to the charcode?

function characterToNumberCoverter(character) {
  let code = character.toUpperCase().charCodeAt(0);
  if (code &gt; 64 &amp;&amp; code &lt; 91) return code - 64
  return 0
}