title: two player rock paper scissors in javascript
body: <p>I was playing with some javascript when I thought "Lets make a simple game!"<br>
  So I started, and now I'm stuck and I could use your help :p<br>
  So this is the 'plan' I made:</p>
  
  <ol>
  <li>Ask user1's name <code>var name1 = prompt("what is your name?");</code></li>
  <li>Ask user2's name <code>var name2 = prompt("what is your name?");</code></li>
  <li>Ask user1's choice <code>var user1 = prompt("rock, paper, scissors");</code></li>
  <li>ask user2's choice <code>var user2 = prompt("rock, paper, scissors");</code></li>
  <li><p>display their choices: </p>
  
  <pre><code>if (user1 === "rock") {
      document.write("&lt;b&gt;rock&lt;/b&gt;");
  } else if (user1 === "scissors") {
      document.write("&lt;b&gt;scissors&lt;/b&gt;");
  } else if (user1 === "paper") {
      document.write("&lt;b&gt;paper&lt;/b&gt;");
  } else {
      alert("DUDE THAT AINT NO OPTION YO");
  }
  
  document.write(" vs ");
  
  if (user2 === "rock") {
      document.write("&lt;b&gt;rock&lt;/b&gt;");
  } else if (user2 === "scissors") {
      document.write("&lt;b&gt;scissors&lt;/b&gt;");
  } else if (user2 === "paper") {
      document.write("&lt;b&gt;paper&lt;/b&gt;");
  } else {
      alert("DUDE THAT AINT NO OPTION YO");
  }
  
  document.write(" = ");
  </code></pre></li>
  <li><p>calculate outcome: </p>
  
  <pre><code>if (user1 === user2) {
      document.write("tie, try again!");
  }
  
  if (user1 === "rock") {
      if (user2 === "scissors") {
          document.write("yay " + name1 + "&lt;b&gt; wins!&lt;/b&gt;");
      } else if (user2 === "rock") {
          document.write("tie...");
      } else {
          document.write("yay " + name2 + "&lt;b&gt; wins!&lt;/b&gt;");
      }
  } else if (user1 === "paper") {
      if (user2 === "rock") {
          document.write("yay " + name1 + "&lt;b&gt; wins!&lt;/b&gt;");
      } else if (user2 === "rock") {
          document.write("yay " + name2 + "&lt;b&gt; wins!&lt;/b&gt;");
      } else {
          document.write("tie...");
      }
  } else if (user1 === "scissors") {
      if (user2 === "scissors") {
          document.write("tie...");
      } else if (user2 === "paper") {
          document.write("yay " + name1 + "&lt;b&gt; wins!&lt;/b&gt;");
      } else {
          document.write("yay " + name2 + "&lt;b&gt; wins!&lt;/b&gt;");
      }
  } else {
      document.write("wut");
  }
  </code></pre></li>
  <li><p>Here is where I get stuck: I want to create a button to restart from step 3. Step 1 and 2 must NOT be repeated! How do I do this?</p></li>
  </ol>
  
  <p>Thanks in advance!</p>
  
  <p>(code may be messy up there ^ so here's the jsfiddle link: <a href="http://jsfiddle.net/robinvandernoord/c0n2wuuf/" rel="nofollow">http://jsfiddle.net/robinvandernoord/c0n2wuuf/</a>)</p>
  
  <p>PS: should I use document.write, or something else instead?<br>
  //update I used alert() instead, and it's beter, in my opinion.</p>