jeudi 2 février 2017

(javascript)If var xxx Math.floor(Math.random() *6) +1; gives the same number 3 times "do something"

I'm doing simple javascript dice game (using Math.floor(Math.random() *6) +1;) where one player can roll dice more than one time (usually 3 times). I want to implement new rule " if dice roll gives number 6 three times in row do *something". I don't know how to write this. Please help. I'm trying "if dice give 6 + 6 + 6 do something but it isn't working I don't know how to write 3-times in row

  • do something for exemple add class .winner to rolling player



Aucun commentaire:

Enregistrer un commentaire