JSFiddle - React, Tailwind, and code Playground
by Patel1327
HTML
<button onclick = "question()">
start
</button>
JavaScript
function questions(){
var num1;
var num2;
var correctans;
var playerans;
var numcorrect = 0;
for (i= 0 ;i< 5;i++){
num1 = Math.floor(Math.random()*10)+1
num2 = Math.floor(Math.random()*10)+1
correctans = num1+num2
playerans =prompt ("what is "+num1 "+"+num2+"?");
if (playerans == correctans){
numcorrect ++;
}
//make random number
//find correct answer
//ask player question
//check if they got it right
}
alser(numcorrect)
}