In a function, I have a statement like this.
Math.random() > 0.5 ? 'spikes' : 'slime'
I want to add one more variable and let the program randomly choose one of those 3. Lets call it 'stone' How do I change the statement to randomly choose one of the three? I do not want to use arrays to do this. Any help would be appreciated. This is part of an open source code and I am a beginner hence getting difficulties in understanding.
Aucun commentaire:
Enregistrer un commentaire