How to test which button is checked of an existing radio buttons family?

<!DOCTYPE html>
<html>
<body>

<form action="#" method="get">
  <input type="radio" name="gender" value="male" checked> Male<br>
  <input type="radio" name="gender" value="female"> Female<br>
  <input type="radio" name="gender" value="other"> Other  <br>
  <br>
  
  <input type="text" id="csel" size="50"> 
</form> 


<script>
    var options = document.forms[0];
    var txt = "";
    var i;
    for (i = 0; i < options.length; i++) {
        if (options[i].checked) {
            txt = txt + options[i].value + " ";
        }
    }    
    document.getElementById("csel").value = "Selected: " + txt;

</script>

</body>
</html>

Similar running example: https://www.w3schools.com/jsref/prop_radio_checked.asp

Kf