mercredi 28 février 2018

Assigning a random value to a variable

I'm very new to code so I might not understand some answers. I'm having trouble turning a variable into a random number between 1 and 10 in this code.

<script type="text/javascript">
var money = 0

function Random() {
  money = Math.floor((Math.random() * 10) + 1);
}
</script>

I've read that I need to put return followed by the randomizing code somewhere but I just don't understand where I place that on how I use it.




Aucun commentaire:

Enregistrer un commentaire