How to solve the problem below?

How to solve the problem : print 20 random numbers from 1 to 10 . In Js a couple of weeks , stumbled on create a variable with random value , then something comes to me .
Here is the code
<!DOCTYPE html>
<html lang="en">
the <head>
 function random() {
 var rand;
 rand = Math.random() * (20 - 1) + 1 ;
 rand = Math.floor(rand);

Help solve , be grateful !
March 19th 20 at 09:18
1 answer
March 19th 20 at 09:20
Solution
for(var i = 0; i<20; i++){
 var rand = Math.floor(Math.random() * 10);
document.write(rand);
}


SO
Thank you - Rosemarie73 commented on March 19th 20 at 09:23

Find more questions by tags JavaScript