Last active
June 26, 2020 17:31
-
-
Save cetaSYN/a206e4be85778e900da9921d04a8d9fb to your computer and use it in GitHub Desktop.
Script to generate titles for Forbes articles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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