In the following example, I've used a ternary operation instead of repeating else if s. And the code fails to run. I wonder what exactly is wrong with this snippet of code.
var ran = 1 + Math.floor(Math.random() * 100);
(ran <= 25) ?
ran = 1;
: (ran <= 50) ?
ran = 2;
: (ran <= 75) ?
ran = 3;
: ran = 4;
alert(ran);
Aucun commentaire:
Enregistrer un commentaire