+ 1
Math in javaScript
how do i multiply random number from 1 to 10 with other random numbers from 1 to 10?
2 Réponses
+ 4
var number1 = Math.random() * 10 + 1;
var number2 = Math.random() * 10 + 1;
var result = number1 * number2;
console.log(result);
+ 2
function randNum(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
var result = randNum(1, 10) * randNum(1, 10);