In order to use certain variables in two separate functions, there are some considerations to keep in mind. The first function is responsible for calculating and displaying a conjugated verb using these variables. The second function checks the user's answers against these variables and adjusts HTML styling as needed.
The challenge lies in the fact that these variables are calculated randomly each time they are needed:
function randomIntFromInterval(min,max) {
return Math.floor(Math.random()*(max-min+1)+min); }
var tense = randomIntFromInterval(1, 6);
var person = randomIntFromInterval(1, 3);
var number = randomIntFromInterval(1, 2);
var voice = randomIntFromInterval(1, 2);
Declaring them as global variables won't work since they need to be recalculated for each call of the first function. Similarly, creating a separate function for these variables won't solve the issue because both functions require the same values.
How can this dilemma be resolved?