0
I’m developing a website to train multiplication in math. In it, I have a random question. For example, (12x12) and for each question I have to generate three random numbers, where only one of them is the correct answers. In the 12x12 example, one of the 3 numbers has to be the value 144;
Javascript code below:
// essas são as opções.
let option1 = 0;
let option2 = 0;
let option3 = 0;
function geraOptions() {
**gerando os numeros aleatorios numberLeft*numberRight.**
const numberLeft = Math.floor(Math.random(1) * 10);
const numberRight = Math.floor(Math.random(1) * 10);
const multiplicação = numberLeft * numberRight;
// agora eu preciso de algo que gere 3 três numeros com apenas um deles sendo o valor correto da multiplicação e os outros 2 sendo incorretos, mas a cada reload da pagina tem que ser criado em um lugar diferente exemplo:
}
geraOptions();
Man, that’s right, thank you very much helped me a lot, I was not managing to shuffle the replies because always returned in a single position.
– PerviousEight47
how can I call JSON numbers? , by having <p> <p> <p>, I want to get 1 value in each P tag
– PerviousEight47
Pow good guy q helped you. I always think it’s nice to find what I need here. One time we need to give back. About JSON Numbers, note that it is an array so when you interact on it with a for(key in oArray) you generate the number from the position in the array (key + 1) pq in js the keys start at Zero
– Aloiso Gomes
vdd bro, now I figured out how to get the numbers, thanks dnv!
– PerviousEight47
We’re together little brother dev.
– Aloiso Gomes