samedi 18 février 2017

how to loop a random number in javascript

when I try to loop some functions it get stuck on the randomvariable() , how can the random number work on loop without I need to refresh the page everytime

  function randomvariable () {
    randomvariable  = Math.floor(Math.random() * 21);
    document.getElementById("demo").innerHTML =  randomvariable; }



    function launchfunctions()  {
    var count = 0;
    while (count < 10)  {


    randomvariable();   
    count++;

    }
    } 




Aucun commentaire:

Enregistrer un commentaire