Skip to content

Instantly share code, notes, and snippets.

@cetaSYN
Last active June 26, 2020 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cetaSYN/a206e4be85778e900da9921d04a8d9fb to your computer and use it in GitHub Desktop.
Save cetaSYN/a206e4be85778e900da9921d04a8d9fb to your computer and use it in GitHub Desktop.
Script to generate titles for Forbes articles
Array.prototype.randChoice = function() {
return this[~~(Math.random() * this.length)];
}
const sel_opts = [
["Google", ["Chrome", "Android"]],
["Microsoft", ["Edge", "Windows"]],
["Apple", ["iPhone"]],
["Facebook", ["Facebook", "Instagram"]]
];
const genTitle = () => {
let [mfg, product] = sel_opts.randChoice();
product = product.randChoice();
return `${mfg} Just Gave Millions Of Users A Reason To ${["Start", "Stop"].randChoice()} Using ${product}`;
}
// Test
for (let count=0; count<5; count++) {
console.log(genTitle());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment