Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How to create maths game with displayDivisionQuestion function to display two numbers in the Dom and set the bigger of the two numbers first and make the larger number evenly divisible by the smaller. Make the correct answer a whole number

What I have tried:

let operand1 = parseInt(document.getElementById("operand1").textContent);
let operand2 = parseInt(document.getElementById("operand2").textContent);
let operator = document.getElementById("operator").textContent;


} else if (operator ==="/") {
return [operand1 / operand2, "division"];



function displayDivisionQuestion(operand1, operand2) {

document.getElementById("operand1").textContent = operand1 > operand2 ? operand1 : operand2;
document.getElementById("operand2").textContent = operand1 > operand2 ? operand2 : operand1;
document.getElementById("operator").textContent = "/";
}
Posted
Comments
Richard Deeming 12-May-23 8:39am    
Nobody here is going to do your homework for you. Explain precisely what you have tried, what the problem is, and where you are stuck.
adla099 12-May-23 9:57am    
Hello, Thanks for your reply. I have added what I have tried. I am supposed to add a division game to the + - * games.

Display two numbers in the Dom and set the bigger of the two numbers first and make the larger number evenly divisible by the smaller. Make the correct answer a whole number. The game displays the larger number first but when divided it doesn't bring a whole number.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900