Scoring With Multiple Choice Answers

In this case Values 'a' and 'b' are the correct answer, which i would want to give a score of '1' for each of them.

I have tried the scripts below without any success

value = 
(['a'].includes(data.q1) ? 1 : 0) +
(['b'].includes(data.q1) ? 1 : 0);
value = 
  (data.q1 === 'a' ? 1 : 0 )
+ (data.q1 === 'b' ? 1 : 0 );
1 reply