I'm trying to make a constructor for an addition problem generator but when I run my code I get "Uncaught ReferenceError: firstNum is not defined"
function GenAddProb()
{
this.firstNum = returnRandomInt(1,10);
this.secondNum = returnRandomInt(1,10);
this.ans = firstNum+secondNum;
}
Is there something wrong with the way my constructor is written? From what I've seen in tutorials I don't have to define firstNum and secondNum as variables before I use them in the constructor.
this.ans = firstNum+secondNum;where you found firstNum and secondNum?