Madlibs

by Erik Wiessmann

Set up

Set up a website, javascript, and css file.

Plan

Ask the participant questions and then tell them a story. Using their answers to direct the narrative. The results are often humerous.

We will need to store our answers in variables. We can use arrays to store lists of answers captured.

You can see examples with a simple websearch for madlibs.

We need to write out our story before we start coding

There once was a programmer who woke up every day with a big idea. They regularly would finish their work before noon and would have the rest of the day to run 100 miles. This programmer had a collection of many pets and took time to take care of them. Their favorite was very quiet. One day the programmer woke up with nothing on their mind to do. This made the programmer quite sad. So they went to their friends house and ate some cake.

We must then change our story and place questions

There once was a job who woke up every day with a adjective idea. They regularly would finish their work before time of day and would have the rest of the day to activity. This job had a collection of many things and took time to take care of them. Their favorite was very adjective. One day the job woke up with nothing on their mind to do. This made the job quite adjective. So they went to their friends place and ate some food.

NOTE: I plan on keeping the job the same in all places.

Let us ask some questions!

Now we can build the new story with the users answers.

Now we can tell our story. We can do this in a few ways...

To the console:

To an alert box:

To text on our webpage:

NOTE: We must add a little html here