Javascript variable not being recognized in subsequent functions

I am making a guessing game, and the first thing the user does is input their name. I called this variable fname, and then I made the first letter uppercase and the rest lowercase by making a var res=fname.charAt(0).toUpperCase() + fname.slice(1);. When I try to reference res in subsequent functions, I get “Unexpected Identifier” and startGame() is not defined in console. What did I do wrong? 

here is my code: https://github.com/jossg14/ap-computer-science-principles/blob/master/finalguessingGame.html 

Programming is absolutely unforgiving. 

msg.innerHTML = "Sorry" + res + "," guess + " is invaild, but won't hurt your score! Guess a # 1-100";

You are missing the plus sign between “,” and guess.