-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MNG-27_question_generator #22
Conversation
src/service/QuestionGenerator.js
Outdated
for (let i = 1; i <= 4; i++) { | ||
currentQuestionsArray.push(randomNumberInRange(this.minPokeId, this.maxPokeId, this.askedQuestions)); | ||
}; | ||
this.askedQuestions = this.askedQuestions.concat(currentQuestionsArray); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion it would be better to use push()
instead of concat()
here.
Check: https://stackoverflow.com/questions/44572026/difference-between-concat-and-push
but both works fine 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, the algorithm is wrong - you mixed askedQuestions
array and currentQuestionArray
array. Those should be used differently.
Reminder/hint:
the only nonrepeating
things are:
- 4/6 answers in one question should be nonrepeating (it is
currentQuestionArray
) - all 30 correct answers in whole quiz should be nonrepeating (it is
askedQuestions
), bad answers can within whole quiz can repeat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! :)
No description provided.