+ 1

Math in javaScript

how do i multiply random number from 1 to 10 with other random numbers from 1 to 10?

13th May 2018, 3:58 PM
Gaia
Gaia - avatar
2 Respuestas
+ 4
var number1 = Math.random() * 10 + 1; var number2 = Math.random() * 10 + 1; var result = number1 * number2; console.log(result);
13th May 2018, 5:04 PM
Naveen Maurya
Naveen Maurya - avatar
+ 2
function randNum(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } var result = randNum(1, 10) * randNum(1, 10);
13th May 2018, 4:20 PM
TurtleShell
TurtleShell - avatar