I'm having difficulty creating a random string of words to be used in a typing speed test.
The String generator file I wrote is as follows:
const WordGenerator = () => {
const WordBank = [
'difficulty',
'never',
'furniture',
'thus',
'transportation',
'opportunity',
'beautiful',
'exactly',
'standard',
'kept',
'baseball',
'perfectly',
'term',
'egg',
'must',
'fix',
];
let result = '';
for (let i; i <= 200; i++) {
result = result.concat(WordBank[Math.floor(Math.random() * 16)], ' ');
}
return result;
};
console.log(WordGenerator());
For some reason when I console.log this, it returns an empty string. I was hoping to have a string of 200 random words from the word bank.
Any suggestions?
ps: I had to remove words from the word bank because stack overflow wasn't allowing me to have so much code, Im originally using 250 words in the wordBank.