In my Javascript code, I increment the counter when the right radio button is checked but when I check in the console, the counter doesn't get updated after the correct radio button is checked. Even after I click the submit button which calls a function clicked() that displays the counter. The counter still remains zero. Is there a reason why it doesn't get updated. Here is my Java Script code:

```js
var counter = 0;

if (document.getElementById('blue').checked) {
  counter++;
}

if (document.getElementById('age3').checked) {
  counter++;
}

if (document.getElementById('hobby2').checked) {
  counter++;
}

if (document.getElementById('game3').checked) {
  counter++;
}

if (document.getElementById('language4').checked) {
  counter++;
}

function clicked() {
  document.getElementById("result").innerHTML = "You got " + counter;
}
```

```html
<h1>Quiz</h1>

<form>
  <p>(1) What is my favourite Color?</p>
  <input type="radio" id="blue" name="color" value="blue">
  <label for="blue">blue</label><br>
  <input type="radio" id="red" name="color" value="red">
  <label for="red">red</label><br>
  <input type="radio" id="green" name="color" value="green">
  <label for="green">green</label><br>
  <input type="radio" id="purple" name="color" value="purple">
  <label for="purple">purple</label>

  <br>

  <p>(2) How Old am I?</p>
  <input type="radio" id="age1" name="age" value="20">
  <label for="age1">20</label><br>
  <input type="radio" id="age2" name="age" value="22">
  <label for="age2">22</label><br>
  <input type="radio" id="age3" name="age" value="21">
  <label for="age3">21</label><br>
  <input type="radio" id="age4" name="age" value="23">
  <label for="age4">23</label>

  <br>

  <p>(3) Which of the following is not of a hobby of mine?</p>
  <input type="radio" id="hobby1" name="hobby" value="swimming">
  <label for="hobby1">swimming</label><br>
  <input type="radio" id="hobby2" name="hobby" value="soccer">
  <label for="hobby2">soccer</label><br>
  <input type="radio" id="hobby3" name="hobby" value="chess">
  <label for="hobby3">chess</label><br>
  <input type="radio" id="hobby4" name="hobby" value="coding">
  <label for="hobby4">coding</label>

  <br>

  <p>(4) Which of the following is a game that I like?</p>
  <input type="radio" id="game1" name="game" value="NBA">
  <label for="game1">NBA</label><br>
  <input type="radio" id="game2" name="game" value="FortNite">
  <label for="game2">FortNite</label><br>
  <input type="radio" id="game3" name="game" value="God of War">
  <label for="game3">God of War</label><br>
  <input type="radio" id="game4" name="game" value="Call of Duty">
  <label for="game4">Call of Duty</label>

  <p>(5) At what is my favourite language</p>
  <input type="radio" id="language1" name="language" value="python">
  <label for="language1">python</label><br>
  <input type="radio" id="language2" name="language" value="Javascript">
  <label for="language2">Javascript</label><br>
  <input type="radio" id="language3" name="language" value="C++">
  <label for="language3">C++</label><br>
  <input type="radio" id="language4" name="language" value="Java">
  <label for="language4">Java</label><br><br>

</form>

<button onclick="clicked()">Submit</button>

<p id="result"> </p>
```