title: How do I get the return of a result from a Win or loss in Rock paper scissors javascript
body: <p>How would I update the game score after each result? This is something i've been working on in console as part of a school project and spent way too much time trying to tie this up. I have managed to get the results to show on the console as who is the winner based on the switch and cases but how do I take that extracted outcome of string text and make something that will update the game array? Sorry if i'm not asking the right question</p>
  <pre><code>const game = {
    win: 0,
    loss: 0,
  };
  
  const choices = [&quot;rock&quot;, &quot;paper&quot;, &quot;scissors&quot;];
  
  var random1 = Math.round(Math.random() * 2);
  var random2 = Math.round(Math.random() * 2);
  
  var bot1 = choices[random1];
  var bot2 = choices[random2];
  
  console.log(&quot;Player 1:&quot; + bot1);
  console.log(&quot;Player 2:&quot; + bot2);
  
  var result = &quot;&quot;;
  
  function returnResult() {
    switch (bot1) {
      case &quot;paper&quot;:
        switch (bot2) {
          case &quot;rock&quot;:
            console.log(&quot;Player 1 Wins!&quot;);
            result = win++;
            break;
          case &quot;scissors&quot;:
            console.log(&quot;Player 2 Wins!&quot;);
            result = loss++;
            break;
          case &quot;paper&quot;:
            console.log(&quot;Draw!&quot;);
            break;
        }
    }
  
    switch (bot1) {
      case &quot;rock&quot;:
        switch (bot2) {
          case &quot;scissors&quot;:
            console.log(&quot;Player 1 Wins!&quot;);
            result = win++;
            break;
          case &quot;paper&quot;:
            console.log(&quot;Player 2 Wins!&quot;);
            result = loss++;
            break;
          case &quot;rock&quot;:
            console.log(&quot;Draw!&quot;);
            break;
        }
    }
  
    switch (bot1) {
      case &quot;scissors&quot;:
        switch (bot2) {
          case &quot;paper&quot;:
            console.log(&quot;Player 1 Wins!&quot;);
            result = win++;
            break;
          case &quot;rock&quot;:
            console.log(&quot;Player 2 Wins!&quot;);
            result = loss++;
            break;
          case &quot;scissors&quot;:
            console.log(&quot;Draw!&quot;);
            break;
        }
    }
    return result;
  }
  console.log(results);
  </code></pre>