$(function() {
var number = document.getElementById("breuken");
var i=0;
for (i=1;i<=10;i++){
var fRandom = Math.floor(Math.random()*10);
var sRandom = Math.floor(Math.random()*10);
var calc = fRandom - sRandom;
number.innerHTML += "" + fRandom + " - " + sRandom + " = " + calc + "<br />";
}
number.innerHTML;
});
Basically, what it does now is it shows 2 random numbers under 10. it subtracts the second number from the first number.
What I would like is to have the first number always be higher than the second number so I won’t get any answers like ‘-3’.
just use
Math.abs()?In case orders are important, you can also do