Mixed Messages :: Knock Knock joke generator

Hi, all :grinning_face_with_smiling_eyes:

Here’s my portfolio project. I stuck with the Knock Knock jokes as I liked the consistent structure which can obviously easily replicated in output.

You can find the repo here: message_generator

I would be grateful for any review / feedback especially coding style, tips etc. At this stage everything’s working but I know I’m probably committed style issues which I would like to knock over now (excuse the pun!)

Thank you and stay safe!

2 Likes

Hi,

Nice job!

In terms of feedback, I wonder if this can be abstracted a little further:

function initJokeStore() {
  jokeStore.addJoke('Cow says.','No, a cow says mooooo!');
  jokeStore.addJoke('Armageddon.','Armageddon a little bored. Let’s go out.');
  jokeStore.addJoke('Stopwatch.','Stopwatcha doin’ and open the stupid door.');
  jokeStore.addJoke('Rough.','Rough, rough, rough! It’s your dog!');
  jokeStore.addJoke('Jester.','Jester silly old man!');
  jokeStore.addJoke('Egg.','Eggcited to see me?');
  jokeStore.addJoke('Amish!','You’re not a shoe!');
  jokeStore.addJoke('Dishes!','Dishes the police come out with your hands up.');
  jokeStore.addJoke('Gorilla!','Gorilla burger! I’ve got the buns!');
  jokeStore.addJoke('Twit.','Did anyone else hear an owl?');
}

So for example it takes a txt file (or json or whatever) and process it where for every line it runs jokeStore.addJoke(line);. That way you can reduce those 10 or so lines to maybe 1 or 2 :slight_smile: . And then anyone can come and insert their joke file and have the program be tailored to their humor…

3 Likes

Great shout. I’ll do that and repost. Thanks for the feedback.

Great job, I liked it !

1 Like

Hi, @toastedpitabread.

I’ve made the proposed changes … the app now will import a txt file and generate the jokes.

1 Like