Silly words message generator

[codebyte]
const quirkyVerbs = [
“Galumph”,
“Skedaddle”,
“Bumble”,
“Wibble”,
“Flibbertigibbet”,
“Snicker-snack”,
“Piffle”,
“Mosey”,
“Bamboozle”,
“Dillydally”
];
const quirkyAdjectives = [
“Whimsical”,
“Befuddled”,
“Squishy”,
“Zigzagging”,
“Giggly”,
“Wonky”,
“Bumptious”,
“Mirthful”,
“Jittery”,
“Zesty”
];
const quirkyNouns = [
“Kaleidoscope”,
“Flibbertigibbet”,
“Whirligig”,
“Gobbledygook”,
“Hullabaloo”,
“Shenanigans”,
“Pandemonium”,
“Malarkey”,
“Gadabout”,
“Brouhaha”
];
const prepositions = [
“about”,
“above”,
“across”,
“after”,
“against”,
“along”,
“among”,
“around”,
“at”,
“before”,
“behind”,
“below”,
“beneath”,
“beside”,
“between”,
“beyond”,
“by”,
“down”,
“during”,
“except”,
“for”,
“from”,
“in”,
“inside”,
“into”,
“like”,
“near”,
“of”,
“off”,
“on”,
“onto”,
“out”,
“outside”,
“over”,
“past”,
“through”,
“to”,
“toward”,
“under”,
“until”,
“up”,
“upon”,
“with”,
“within”,
“without”
];

// Function to get a random element from an array
function getRandomElement(array) {
return array[Math.floor(Math.random() * array.length)];
}

// Function to generate a random silly message
function generateSillyMessage() {
const subjectAdjective = getRandomElement(quirkyAdjectives);
const subjectNoun = getRandomElement(quirkyNouns);
const predicateAdjective = getRandomElement(quirkyAdjectives);
const predicateNoun = getRandomElement(quirkyNouns);
const preposition = getRandomElement(prepositions);

return The ${subjectAdjective} ${subjectNoun} ${preposition} ${predicateAdjective} ${predicateNoun}.;
}

// Generate and log a random silly message
console.log(generateSillyMessage());[/codebyte]

Hello,
I have also been working on the same project though my code is way too simple. I am glad I saw your project, you have truly made it random and flexible. Here is my code:

const messages = [
“Hello, how are you today?”,
“The sun is shining bright :sunny:”,
“Coding is so much fun! :computer:”,
“Never give up on your dreams :sparkles:”,
“What’s your favorite color?”,
“Let’s go on an adventure! :earth_africa:”,
“Stay positive and keep smiling! :blush:”,
“Life’s too short to worry about the little things!”,
“Believe in yourself and anything is possible! :star2:”,
“Coffee is always a good idea! :coffee:
];

function generateRandomMessage() {
let randomMessage = messages[Math.floor(Math.random()* messages.length)]
return randomMessage
}

console.log(generateRandomMessage());

1 Like

Very straight forward and satisfies the project goals.

1 Like