JSFiddle - React, Tailwind, and code Playground

JavaScript

(function() {
  "use strict";
  function print(message) {
  document.write(message);
}
function toAList(list){
var htmlChange = '<ol>';
for (x=0; x < list.length; x++){  
htmlChange += "<li>" + list[x][0] + "</li>";
}
htmlChange += '</ol>'
print(htmlChange);
}


var score = 0;
var quiz=[
 ["What is 2 + 3?", 5],
 ["What is 3 - 1?", 2],
 ["What is 8 - 2?", 6]
]
var correct = [];
var wrong = [];
for (i=0; i < quiz.length; i++){
  var userAnswer = parseInt(prompt(quiz[i][0]));
  if (userAnswer === quiz[i][1]){
    correct[correct.length] = quiz[i];
    score +=1;
  }else{
  wrong[wrong.length] = quiz[i];
    score -=1;
  }
 }
print("You got " + correct.length + " question(s) correctly!<br>");
print("Your final score is " + score + "<br>");
print("<b>These are the questions you got correct:</b>")
toAList(correct);
print("<b>These are the questions you got wrong:</b>");
toAList(wrong);
}());