values
stores the selected value from the last radio button group you check. You're then iterating over
the properties and methods of
the string
type[
^], which isn't what you want.
You shouldn't need a separate field - the value of the selected radio buttons will be posted back to the server when you submit your form. But if you still want to do it, you'll need to push the selected values into an array:
let array = [];
let theForm = document.getElementById("form1");
for (let i = 1; i <= count; i++) {
array.push(getRadioVal(theForm, 'name' + i));
}
document.getElementById('hdnValue').value = JSON.stringify(array);