I am making a quiz and I want to find out which button has the most clicks so I can give the answer
I have these variables in the start set to zero and their scores will increase by user input
var earthScore = 0;
var venusScore = 0;
whenever the button is clicked a fuction runs
q1a4.addEventListener ("click", earth);
q1a5.addEventListener ("click", venus);
this function will add one to the original variables
function earth () {
earthScore += 1;
questionCount += 1;
}
function venus () {
venusScore += 1;
questionCount += 1;
}
now I want to find out the variable which has the most clicks and give an answer to user so for example; if earth variable has greater score than venus variable then I will change the result to result.innerHTML = 'you are earth'
but I don't know how to find the variable with the greatest score
this is actually my first project using js so i dont have that much idea and everything i tried to find seems wrong so i would really appreciate if anyone can give me an answer for my program.