mercredi 5 janvier 2022

why Math.floor(Math.random()*10) returns undefined [closed]

this program should return only numbers between 0-6. How it gets a value undefined?

function dice() {
  var a = Math.floor(Math.random() * 10)

  while (a > 0 && a < 7)
  {
    return a;
  }
}



Aucun commentaire:

Enregistrer un commentaire