I am pretty new to programming and I am trying to make a math game where The javaScript program should allow users to enter two numbers and generate a random mathematical operations (+, -, /, *) I know I have to use math.random to do this but I am not sure where to put it in the code or how to use it properly yet. Can anybody give me a quick run down on how I would do this ?
Sorry for the bad explanation I'll try to be more detailed in what I'm trying to do. This is my code so far
var a = prompt("Enter a number");
var b = prompt("Enter a number");
var correctAnswer = Number(a) + Number(b);
var user=AnswerNumber(prompt("What is " + a + " + " + b));
if(correctAnswer == userAnswer) {
alert("you are correct");
} else {
alert("you are NOT correct. The answer is " + correctAnswer );
}
Now I want to be able to make it so uses can enter 2 number and the program generates a random mathematical operation such as (+,-,*,/,) I know math.random can help do this but I am having trouble understanding how and where to put it in the code.