I'm designing a quiz motivator, i.e. if a user inputs any number of correct answers he's gonna get rewarded with a "star" or smth. The array in a pseudo code below represents a range of correct answers to choose from:
var rightAnswers = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];
if (rightAnswers.chooseAny(3)) {user gets a star}
else if (rightAnswers.chooseAny(6)) {user gets 2 stars}
else if (rightAnswers.chooseAny(9) {user gets 3 stars}
I haven't found anything that would work instead of my pseudo "chooseAny()", any ideas, please?
.chooseAny(N)?