I am coding a memory game that allows an alert to flash up with a 5-6 digit code that you have to then remember and place into a prompt box. Here is the code I have so far:
var mathRandom = (Math.round(Math.random()*10000))
alert(mathRandom);
var answer=prompt("What is the number?");
if(answer === mathRandom)
    {
        alert("Well done")
    }
    else
    {
        alert("Wrong")
    }
The problem with my code is that even when you get it right the alert says wrong, I think this is because when I am checking if the variables are equal the mathrandom generates a new number. I was wondering if I could have some help. Thanks
 
     
     
     
     
    