-4
function textoAleatorio(){
var letras = 'abcdefghijklmnopqrstuvwxyz';
var aleatorio = '';
for (var i = 0; i < 5 ; i++) {
var rnum = Math.floor(Math.random() * letras.length);
aleatorio += letras.substring(rnum, rnum + 1);
}
return aleatorio;
}
console.log(textoAleatorio())
Well, you’re only calling the function 1 time... To generate 10,000 words, you’d need to call it 10,000 times (within a loop of repetition, obviously).
– Rafael Tavares