JavaScript
var keyArr;
$('#bu').click( function() {
$('p').show();
keyArr = [];
var mSize = selectRandom( size ),
mMusc = selectRandom( muscularity ),
mAge = selectRandom( age ),
mColor = selectRandom( color ),
mAnimal = selectRandom( animal),
output,
x = mSize.substring(0,1);
if ( x === "a" | x === "e" | x === "i" | x === "o" | x === "u" ) {
mSize = " an " + mSize;
} else {
mSize = " a " + mSize;
}
output = mSize + " " + mMusc + " " + mAge + " " + mColor + " " + mAnimal;
$('#output').text(output);
$('#combo').text(maxCombo());
});
function selectRandom( arr ) {
var key = Math.floor( Math.random() * arr.length );
keyArr.push(key);
return arr[key];
}
function maxCombo() {
var maxCombo = 20 * 14 * 9 * 18 * 243;
var thisCombo = ( (keyArr[0] * 14 * 9 * 18 * 243) + (keyArr[1] * 9 * 18 * 243) + (keyArr[2] * 18 * 243) + (keyArr[3] * 243) + (keyArr[4]) );
return "Combination " + thisCombo + " of " + maxCombo + " possible combinations.";
}
var size = ["huge", "colossal", "giant", "minuscule", "humungous", "immense", "mammoth", "towering", "gigantic", "big", "large", "massive", "vast", "enormous", "small", "tiny", "microscopic", "miniature", "regular", "medium"];
var muscularity = ["muscular", "fat", "thin", "skinny", "skeletal", "brawny", "sinewy", "burly", "wiry", "scrawny", "bony", "slender", "lithe", "nimble"];
var age = ["baby", "newborn", "infant", "young", "youthful", "adolescent", "aged", "ancient", "elderly"];
var color = ["white", "silver", "gray", "black", "red", "maroon", "yellow", "olive", "lime", "green", "aqua", "teal", "blue", "navy", "fuchsia", "purple", "gold", "pink"];
var animal = ["aardvark", "albatross", "alligator", "alpaca", "ant", "anteater", "antelope", "ape", "armadillo", "ass", "baboon", "badger", "barracuda", "bat", "bear", "beaver", "bee", "bison", "boar", "buffalo", "butterfly", "camel",...