Question: Task 2 : Switch Statement You will create an application that asks the user to guess a name of one of the seven dwarfs You

Task 2: Switch Statement
You will create an application that asks the user to guess a name of one of the seven dwarfs
You will use the same workspace as Task 1. No need to create another file. Just write your in the same index.html file.
Within the body element and after the code you wrote for Task 1, type the following code:
Write a JavaScript function named dwarfName() within the script tags that does the following:
Stores the user input as a variable.
Hint: It should not matter if the user entered all capital or lower case letters
Using a switch statement, you will display back to the end user some text depending on which dwarf name they entered. Do not use an if/else statement!
Dwarf Name
Text to be displayed back
Bashful
I'm known for my shyness.
Doc
I'm known for his bossy attitude but in a good way, one that represents that of a leader.
Dopey
I'm known for my quietness and my affection for Snow White.
Grumpy
I'm known for my know-it-all attitude and pure stubbornness.
Happy
I'm known for my joyous outlook of the world and always having that smile on my face.
Sneezy
I'm known for constantly sneezing.
Sleepy
I'm know for my ability to fall asleep anywhere and anytime.
If the user entered anything else beside the above 7 names, you will display back the following text and what they entered:
Sorry,(name they entered) is not a name of the 7 dwarfs.
This is an example of what your screen should look like if they entered a correct dwarf name:
This is an example of what your screen should look like if they entered an incorrect dwarf name:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!