Count if question is answered

This will check each question entered into the script and if answered will +1 to the starting figure of 0
var qanswer = f(‘Numbercounter‘);
var i = 0 ;
    if(f(‘Questiontocheck‘).toBoolean()){
  i = i+1;
qanswer.set(i);
      }
if(f(‘Questiontocheck‘).toBoolean()){
i = i+1;
qanswer.set(i);
  }
If one of the questions above is answered, qnr_rwc_answered will equal 1. If both are answered qnr_rwc_answered will equal 2
To add more questions to this copy this –
if(f(‘Questiontocheck‘).toBoolean()){
 i = i+1;
qanswer.set(i);
  }
and add it to the script, just change the question its looking at.