title: How do I declare a variable inside an if else statement?
body: <pre><code>var user = prompt("what is your name?");
  if (user == "joe")  {
    var game = "what's up joe"
  }
  if (user == "alex") {
    var game = "hello alex how are you"
  }
  else {
    game = "sorry don't know you"
  }
  
  var other = alert(game);
  </code></pre>
  
  <p>For some reason this does not work I want to make game be equal to a number of different things. If I use more than 3 if statements game is always equal to the last one. Could someone please help me?</p>