-
-
Save topherPedersen/9a27bd0bb15b560236433c10f570b7b6 to your computer and use it in GitHub Desktop.
Random word generation in JS.
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.randomElement = function () { | |
return this[Math.floor(Math.random() * this.length)]; | |
} | |
var consonant = [ | |
"th", | |
"th", | |
"n", | |
"mb", | |
"r", | |
"f", | |
"n", | |
"w", | |
"v", | |
"nt", | |
"r", | |
"f", | |
"nd", | |
"s", | |
"c", | |
"b", | |
"z", | |
"v", | |
"m", | |
"br", | |
"l", | |
"rg", | |
"st", | |
"p", | |
"gl", | |
"mc", | |
"pl", | |
"gh", | |
"th", | |
"n", | |
"mb", | |
"r", | |
"f", | |
"nds", | |
"nn", | |
"nc", | |
"d", | |
"nn", | |
"ll", | |
"c", | |
"nt", | |
"n", | |
"d", | |
"t", | |
"gr", | |
"w", | |
"v", | |
"r" | |
]; | |
var vowel = [ | |
"a", | |
"e", | |
"u", | |
"i", | |
"o" | |
]; | |
for (var i = 0; i < 10; i++) { | |
var word = consonant.randomElement() + vowel.randomElement() + consonant.randomElement() + vowel.randomElement() + consonant.randomElement(); | |
console.log(word); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment