Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created February 20, 2023 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YonatanKra/a1241a29c455afa26617a147e675f62a to your computer and use it in GitHub Desktop.
Save YonatanKra/a1241a29c455afa26617a147e675f62a to your computer and use it in GitHub Desktop.
async function verifyAnswer(question) {
const answer = prepareAnswerFromTextFields();
const response = {};
const questionIndex = QUESTIONS.findIndex(x => x.id === question.toString());
response.error = !ANSWERS[questionIndex].includes(answer);
if (response.error) {
error(response.error);
} else {
success();
addNextQuestion(QUESTIONS[questionIndex + 1]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment