Currently working on a quiz incentive system where users earn rewards based on the number of correct answers they input. The example array below shows the possible range of correct answers:
var rightAnswers = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];
if (rightAnswers.selectAny(3)) {user receives a star}
else if (rightAnswers.selectAny(6)) {user earns 2 stars}
else if (rightAnswers.selectAny(9) {user is awarded with 3 stars}
I am currently stuck on finding an alternative to my pseudo code method "selectAny()", any suggestions would be greatly appreciated.