Count the number of times an input has been made javascript
<p>What is the best practice when counting the number of times an action has been carried out in javascript? for example I have a prompt that asks for a number</p>

<pre><code> var playerGuess = prompt("What is your guess ");
</code></pre>

<p>What i would like to do is after 3 attempts end the game with another prompt.</p>

<p>What I am having difficulty with is actually counting the number of inputs</p>

<p>Thanks</p>

<p>I have tried creating a function do count the number of times an input has been made</p>

<pre><code>    var guessCount = playerGuess.count;


   function limit(playerGuess){

  if (guessCount &gt;= 3){
   alert("game over");
  } else{
   alert("carry on");
  }

 }
</code></pre>

<p>totally wrong i know but having a go</p>
