For a school project, I am working on creating a completely randomized math quiz utilizing HTML, CSS, Javascript, and possibly JQuery. The quiz should involve three different operators and must also be visually appealing with CSS styling.
I've encountered an issue where the question doesn't display within the designated 'questions' div. Since this is my first time using JavaScript, I realize that there may be several errors in my code. Any assistance or guidance would be greatly appreciated. If you require the full code, please let me know. Thank you.
function getNumber(){
var oplist = ["=", "-", "*"];
num1 = Math.floor((Math.random() * 10) + 1);
num2 = Math.floor((Math.random() * 10) + 1);
op = oplist[Math.floor(Math.random() * oplist.length)];
if (op == "+"){
ans = (num1 + num2)
}
else if (op == "-"){
ans = (num1 - num2)
}
else if (op == "*"){
ans = (num1 * num2)
}
}
document.getElementById("questions").innerHTML = num1 + op + num2;