how to sum/count the radio button values?

i am using react native with typescript language and i am trying to write a function that count the values of checked radio button.
for example:
count-values-checkboxes-radio-buttons (2)

anyone have idea?