Issue with code
Everything works but my result function/button <!DOCTYPE html> <html> <head> </head> <body> <script> result=1; function changevar(){ v1=prompt("Insert your first option"); v2=prompt("Insert your second option"); v3=prompt("Insert your last option"); } function startjs(){ opa="hi"; opb="hi"; opc="hi"; opra = ("People like"+" "+v1); oprb = ("People like"+" "+v2); oprc = ("People like"+" "+v3); opa =prompt("How many people like"+" "+v1); opb =prompt("How many people like"+" "+v2); opc =prompt("How many people like"+" "+v3); result=opa+" "+opra+" "+opb+" "+oprb+" "+opc+" "+oprc; } function result(){ alert(result); if(opa>opb&&opa>opc){ alert("The most people like"+" "+v1); } if(opb>opc&&opb>opa){ alert ("The most people like"+" "+v2); } if(opc>opa&&opc>opb){ alert ("The most people like"+" "+v3); } if(opa==opb&&opa>opc){ alert ("The most people like either "+" "+v1+" "+"or"+" "+v2); } if(opa==opc&&opa>opb){ alert ("The most people like either "+" "+v1+" "+"or"+" "+v3); } if(opb==opc&&opb>opa) { alert ("The most people like either "+" "+v2+" "+"or"+" "+v3); } } </script> <button id=button1 onclick="startjs()">Start</button> <br> <br> <button id=button2 onclick="changevar()">Change Variables</button> <br> <br> <button id=button3 onclick="result()">Result</button> </body> </html>