title: How would you make the result print "computer wins" or "user wins"
body: <p>Obviously, this will print out rock/paper/scissors wins or it's a tie.</p>
  
  <p>What is the best way to achieve a result like "Rock beats scissors -- Computer wins!" and such?</p>
  
  <pre><code>var userChoice = prompt("Do you choose rock, paper or scissors?");
  var computerChoice = Math.random();
  if (computerChoice &lt; 0.34) {
      computerChoice = "rock";
  } else if(computerChoice &lt;= 0.67) {
      computerChoice = "paper";
  } else {
      computerChoice = "scissors";
  } console.log("Computer: " + computerChoice);
  
  var compare = function(choice1, choice2) {
      if (choice1 === choice2) {
          return "The result is a tie!";
      } else if (choice1 === "rock") {
          if (choice2 === "scissors") {
              return "rock wins";
          } else {
              return "paper wins";
          }
      } else if (choice1 === "paper") {
          if (choice2 === "rock") {
              return "paper wins";
          } else {
              return "scissors wins";
          }
      } else if (choice1 === "scissors") {
          if (choice2 === "paper") {
              return "scissors wins";
          } else {
              return "rock wins";
          }
      }
  }
  
  compare(userChoice,computerChoice);
  </code></pre>
  
  <p>I have some knowledge of functions and variables that I think is enough to solve this -- I just can't figure it out. I have less than 8 hours of javascript experience.</p>
  
  <p>Also, this is not my homework, I just finished a lesson in codecademy and wondered this.</p>