0
helpz!
how to generate random string? Example i have A, E, I, O, U whenever i run the code the output will be one of those letter wether it is A, E, I, O or U
4 Answers
+ 5
https://www.sololearn.com/discuss/333866/?ref=app
please edit the title of your question. "helpz!" is not that good. furthermore you already used it before...
to your question: generate a random number from 1 to 5 and use switch case to output the letter.
+ 2
var arr = [ "a","e","i","o","u"];
var rand = Math.floor(Math.random() * arr.length);
console.log(arr[rand]);
+ 2
I made this function for your case.
Check it out(:
https://code.sololearn.com/WDGN0BEk92hW/?ref=app
+ 1
Put these characters into an array and generate a random number from 0 to the array length - 1 and use it as an array index.