+ 5
Random on javascript
did anybody know how to make a random function on sololearn
2 Antworten
+ 10
Math.random();
use👇
var a = Math.random();
So the value of a would be anything between 0 to 1
As per your use you could perform multiply addition division etc...
A random dice would be
document.write(Math.round(Math.random()*5+1);
this☝️will result in a random dice..😊
+ 4