in harness/app-assets/templates/assets/js/modules/quiz.js [142:177]
function getQuestionsAndAnswers() {
var i,
key,
answerMatch,
question,
answer,
answers = {},
correctAnswerWordList = document.getElementsByClassName('quiz__correct-answers')[0].innerHTML.split(' ');
for (i = 0; i < correctAnswerWordList.length; i++) {
// Check if word in this format: 1:A
answerMatch = correctAnswerWordList[i].match(/(\d+):([A-Z])/g);
if (answerMatch && answerMatch.length) {
answer = answerMatch[0];
question = answer.split(':')[0];
answers[question] = {
correctAnswer: answer.split(':')[1]
};
} else {
if (!answers[question].revealText || answers[question].revealText === '- ') {
answers[question].revealText = '';
}
answers[question].revealText += correctAnswerWordList[i] + ' ';
}
}
for (key in answers) {
if (answers.hasOwnProperty(key) && answers[key].revealText) {
// Remove trailing comma in revealText
answers[key].revealText = answers[key].revealText.replace(/,\s*$/, '');
}
}
return answers;
}