JSFiddle - React, Tailwind, and code Playground

HTML

<div id="output"></div>

JavaScript

//variables

var questions =
[
    ['What is 1 + 2?', 3],
    ['What is 2 + 3?', 5],
    ['What is 3 + 4?', 7]
];

var question;
var answer;
var response;
var html;
var rightAnswers = 0;
var rightQuestions = [];
var wrongQuestions = [];

//functions

function print(message)
{
    var outputDiv = document.getElementById('output');
    outputDiv.innerHTML = message;
}

function buildList(array)
{
    var listHTML = '<ol>';
    for (var i = 0; i < array.length; i ++)
    {
        listHTML += '<li>' + array[i] + '</li>';
    }
    listHTML += '</ol>';
    return listHTML;
}

//loop

for (var i = 0; i < questions.length; i ++ )
{
    question = questions[i][0];
    answer = questions[i][1];
    response = parseInt(prompt(question));
    if (response == answer)
    {
        rightQuestions.push(question);
        rightAnswers ++;
    }
    else
    {
        wrongQuestions.push(question);
    }
}

//messages

html = 'You got ' + rightAnswers + ' questions(s) right.'
html += '<h2>You got these question(s) correct:</h2>';
html += buildList(rightQuestions);
html += '<h2>You got these question(s) wrong:</h2>';
html += buildList(wrongQuestions);

print(html);