title: Why is my code to identify TIE in Math.max not working?
body: <p>Hi I created a code that would print false if there is one max number in an array and true if there is two or more of the same max number. However, it is not working even though the following works:</p>
  <pre><code>let diceScores = [2,6,5,6];
  let maxScore = Math.max(...diceScores);
  diceScores.filter(x =&gt; x === maxScore).length &gt; 1 ? console.log('tie') :console.log('no tie');
  </code></pre>
  <p>That is the code that I learnt that works. Now I modified it into my website as I needed to store the true or false into a <code>var isTie;</code> and it doesn't work...can someone please tell me why so i can learn too, thanks in advance.</p>
  <p>My code (doesn't work):</p>
  <pre><code>var randomNumber1 =2;
  var randomNumber2 =5;
  var randomNumber3 =5;
  var isTie; 
  var userChoices = [];
  var noOfChoices = 3
  
   if (noOfChoices === &quot;3&quot;) {
      userChoices.push(randomNumber1, randomNumber2, randomNumber3);
      let maxScore = Math.max(userChoices);
      userChoices.filter(x =&gt; x === maxScore).length &gt; 1 ? isTie = &quot;True&quot; : isTie = &quot;False&quot;;
      console.log(isTie);
    }
  </code></pre>