Answer:
You can generate random numbers, do the math to get the answer your expect, and then compare your expected answer with the actual answer of the user :
var a = Math.floor(Math.random() * 10); // A number between 0 and 10
var b = Math.floor(Math.random() * 10); // Another number between 0 and 10
var expectedAnswer = a + b;
var answer = prompt(a + " + " + b);
if (answer == expectedAnswer)
alert('Good job !');
else
alert('Wrong answer :()');
Explanation:
hope this helps. it's about complicated