6
Whoa, guys, I’m new to both stackoverflow and JS!
Next, I’m having trouble making a script that chooses a string within an array I wrote the code as follows:
let choices = ['a', 'b', 'c']
Math.floor(choices)
and returns not a number which is perfectly understandable, since the array values are strings, but as had said I’m new in the world of JS and I don’t know if the Math method is the best for the task, the same script in python would be much simpler:
import random
choices = ['a', 'b', 'c']
random.choice(choises)
I would like to know if you(a) would have any method suggestion in the JS that returns the value as in the code in Pythom. Thanks in advance!
Great bro, very simple syntax until it looks like python! Solved my problem worth!
– Elias Oliveira