How to get radio button value in JavaScript using name?

To get radio button value in JavaScript using name, do this: document.querySelector('[name=radio-button]:checked').value.

For example, if this is your radio button:

<input type="radio" name="radio-button" id="option-1" value="option-1">
<label for="option-1">Option 1</label>
<input type="radio" name="radio-button" id="option-2" value="option-2">
<label for="option-2">Option 2</label>

Then you can get its value with this JavaScript:

document.querySelector('[name=radio-button]:checked').value