Write a JavaScript program that uses:
JavaScript and jQuery, Chapters 1 through 3.
1.Write a program that generates mad libs based on input from the user. The program will ask the user for their first name and then use that name to greet the user. It will then prompt the user for at least four different types of words and generate a mad lib sentence or paragraph based on the user's input.
2.The program should use a function to get the user's first name. It will then output a greeting to the user directly from the function. (See the example below.)
3.You are required to use a function to gather the words from the user used to fill in the blanks of the mad lib. Write a function that takes in a string representing the category of the word (ex: "noun", "adjective", etc.). The function should then use a prompt() to ask the user to input a word of that type. The function should then return what the user entered. For example, if you pass in the string "noun" to the function, the function should ask the user "Please enter a noun." and return the string that they entered.
4.Generate a mad-lib by calling the function multiple times and storing the returned words in variables. You can stitch together the variables along with string values to make a mad lib. See this website for an example of some Mad Libs that you can use. Feel free to be creative: http://www.redkid.net/madlibs/
Example:
Prompt: "Welcome to the Mad Lib program. What's your name?"
Input "Bill"
Alert: "Pleased to meet you, Bill! Let's get started."
Prompt: "Please enter an exclamation:"
Input: "ouch"
Prompt: "Please enter an adverb:"
Input: "stupidly"
Prompt: "Please enter a noun:"
Input: "cat"
Prompt: "Please enter an adjective:"
Input: "brave"
Alert: Here's your madlib! "ouch! he said stupidly as he jumped into his convertible
cat and drove off with his brave wife."