Skip to content

Commit

Permalink
Fix formatting of answers in parseQuestions function
Browse files Browse the repository at this point in the history
  • Loading branch information
muznyo committed Jan 13, 2024
1 parent 87f598f commit 02b07ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ function parseQuestions(data) {
parsedData.forEach(item => {
let currentQuestion = {
question: item.question,
correctAnswers: item.right_answers.map(answer => answer.replace(/(\w)\^(\w+)/g, '$1<sup>$2</sup>').replace(/<br>/g, '').replace(/>/g, '&gt;').replace(/</g, '&lt;')),
incorrectAnswers: item.wrong_answers.map(answer => answer.replace(/(\w)\^(\w+)/g, '$1<sup>$2</sup>').replace(/<br>/g, '').replace(/>/g, '&gt;').replace(/</g, '&lt;'))
correctAnswers: item.right_answers.map(answer => answer.replace(/(\w)\^(\w+)/g, '$1<sup>$2</sup>').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/&lt;sup&gt;/g, '<sup>').replace(/&lt;\/sup&gt;/g, '</sup>')),
incorrectAnswers: item.wrong_answers.map(answer => answer.replace(/(\w)\^(\w+)/g, '$1<sup>$2</sup>').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/&lt;sup&gt;/g, '<sup>').replace(/&lt;\/sup&gt;/g, '</sup>'))
};
questions.push(currentQuestion);
});
Expand Down

0 comments on commit 02b07ad

Please sign in to comment.