Madlibs Lab

Instructions & Help

📝 Open the Lab (new tab) →
🎯

What You're Building

Function with Parameters Loop Conditional Statement

This lab is a before-and-after story. makestory() is already complete and only handles nouns - and it even has a comment telling you to copy-paste-and-modify it three more times for verbs, adjectives, and adverbs. Instead, you'll build swapWords(input, output): the SAME logic, written once, made generic with two parameters, so it can be reused for all four word types instead of copied four times. Fill in the missing code in code.js, one TODO at a time.

✏️

Need Help Coding?

Try each TODO yourself first. If you get stuck, use the hint button for that spot — hints start vague and get more specific. The last hint is the literal answer.

⏱ Hints are on a shared 30-second timer. Asking for a hint anywhere locks every hint button on the page — there's no dodging the wait by jumping to a different blank.

🔮

Predict & Check

These focus on WHY the function takes parameters, and what "returning true or false" actually buys you. One attempt per question.

🏆

Your Certificate

Your certificate below is based on your Predict & Check results. It updates automatically as you answer questions.

🎨

Make It Yours

Once your code works and you've finished Predict & Check, try any of these: