title: Ternary Condition for if { } else if { if { } else { } }
body: <p>I want to change all the <code>if</code> <code>else</code> statements to ternary operator. Whats the ternary operator for this <code>if</code> <code>else</code> statements ?</p>
  
  <pre><code>  const compareHands = (playerChoice, computerChoice) =&gt; {
          // Update Text
          const winner = document.querySelector('.winner');
          const winnerIs = (who, isPlayerWin) =&gt; {
  
              winner.textContent = `${who} Wins!`;
  
              isPlayerWin ? pScore++ : cScore++;
  
              updateScore();
          };
  
  
  
          // Check for tie
          if (playerChoice === computerChoice) {
              winner.textContent = 'It Is A Tie!';
              // Check For Winner
          } else if (playerChoice === 'rock') {
              if (computerChoice === 'scissors') {
                  winnerIs('Player', true);
              } else {
                  winnerIs('Computer', false);
              }
          } else if (playerChoice === 'paper') {
              if (computerChoice === 'scissors') {
                  winnerIs('Computer', false);
              } else {
                  winnerIs('Player', true);
              }
          } else if (playerChoice === 'scissors') {
              if (computerChoice === 'rock') {
                  winnerIs('Computer', false);
              } else {
                  winnerIs('Player', true);
              }
          }
      }
  </code></pre>