🚀 Basics Day 5: In-Class Exercises 🚀

Pre-Class In-Class

Base: Mad Libs Adjectives

  1. When the app loads, the user can input 1 adjective at a time to store in the app. Store the user-inputted adjectives in a global array variable.
  2. When the user inputs the word "create" the app completes the Mad Lib with a random word from the user-inputted adjectives array and outputs the completed Mad Lib in the grey box.

Input:


Output:

Comfortable: Input and Create Mode

When the app loads it starts in "input", or normal mode. In input mode, the user can add adjectives to their adjectives list with each Submit.

When the user inputs "create", change the game mode to create mode. In create mode, each Submit prompts the app to complete your Mad Lib.


Input:


Output:

Comfortable: Input Multiple Words

When the app loads, the user can input 1 or more adjectives to store in the app with each Submit. To input more than 1 word for each Submit, the user would give each word separated by a space, e.g., "green nice silly". We can use JavaScript's string split method to split the input string into an array of substrings.


Input:


Output:

More Comfortable: Mad Libs Multiple Word Types

Update our Mad Lib to take additional word types.

Create modes to input words from different word types, e.g. exclamation, adverb, noun, and adjective. For each type, prompt the user what type of word they should be entering. If it's too tedious to support 4 word types, considering starting with 2 word types.


Input:


Output:

More Comfortable: Popular Mad Libs

Keep track of which words are selected. Create and allow the user to switch to a new game mode that always shows a completed Mad Lib on Submit using the set of words (verb, adjective, etc.) that the app has (randomly) selected most often so far.


Input:


Output:

More Comfortable: Sets of Mad Libs

Store an array of Mad Lib sentences in your app.

Update create mode to pick a random Mad Lib sentence and set of words and output the completed Mad Lib in the grey box on Submit.


Input:


Output: