- ChrisLv 74 months ago
Split the text at spaces:
const parts = someText.split(" ");
Now pick a random element:
const part = parts[Math.floor(Math.random() * parts.length))];
Still have questions? Get your answers by asking now.