How to Code a Phrasal Template Word Game Using Javascript

Phrasal word template games are game in which the player fills in a random part of speech, not knowing what it will be applied to. The most popular example of this is MadLibs. This is a fun game to code and play, and you will be proud once...

Method 1 of 2:

Setting Up the Story Template

  1. Picture 1 of How to Code a Phrasal Template Word Game Using Javascript
    Use a Notepad-type program or application to write up a story. Do not add in the blanks just yet.
    1. Example: One sunny day, Tom went to the grocery store to buy some ham. When he got home, he discovered that his sister had already bought some ham while he was gone.
  2. Picture 2 of How to Code a Phrasal Template Word Game Using Javascript
    Add in the blanks. You may add in blanks where there are names, places, nouns, adjectives, verbs, adverbs, prepositions, numbers, animals, body parts, foods, etc.
    1. Example: One (Adjective) day, (Male Name) went to the (Place) to (Verb) some (Plural Food). When he got home, he (Past Tense Verb) that his (Family Member) had already bought some (Same Plural Food) while he was gone.
  3. Picture 3 of How to Code a Phrasal Template Word Game Using Javascript
    Convert your new story into code. The variables will be defined in the next step, so don't worry about them just yet.
    1. Example: alert ('One ' + adj + ' day, ' + maleName +  ' went to the ' + place + ' to ' + verb + ' some ' + pluralFood + '. When he got home, he ' + pastVerb + ' that his ' + famMember + ' had already bought some ' + sameFood + ' while he was gone. ')
Method 2 of 2:

Setting Up the Variables to Fill in the Blanks

  1. Picture 4 of How to Code a Phrasal Template Word Game Using Javascript
    Code the variables using prompts. For each one, type "var nameOfVble = prompt ('Type a name of variable below. ')", replacing "nameOfVble" and "name of variable" with the part of speech. Replace "a" with "an" if necessary.
    1. Example:
    2. var adj = prompt ('Type an adjective below! ')
    3. var maleName = prompt ('Type a male name below! ')
    4. var place = prompt (Type a kind of place below! ')
    5. And so on.
  2. Picture 5 of How to Code a Phrasal Template Word Game Using Javascript
    Add in the story code.
    1. Example:
    2. var adj = prompt ('Type an adjective below! ')
    3. var maleName = prompt ('Type a male name below! ')
    4. var place = prompt ('Type a kind of place below! ')
    5. var verb = prompt ('Type a verb below! ')
    6. var pluralFood = prompt ('Type a plural food below! ')
    7. var pastVerb = prompt ('Type a past tense verb below! ')
    8. var famMember = prompt ('Type a kind of family member below! ')
    9. var sameFood = prompt ('Type the word ' + pluralFood + ' below! ')
    10. alert ('One ' + adj + ' day, ' + maleName +  ' went to the ' + place + ' to ' + verb + ' some ' + pluralFood + '. When he got home, he ' + pastVerb + ' that his ' + famMember + ' had already bought some ' + sameFood + ' while he was gone. ')
Update 05 March 2020
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile