I can't get my javascript alerts to show up | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I can't get my javascript alerts to show up

Right now I am using Javascript to try to create a series of alerts for a story but I can't get all of the prompts to show up. Can somebody help me? https://code.sololearn.com/WIqhAnqGq3kK/#js

4th Mar 2018, 2:48 AM
Marquis Patton
2 Answers
+ 2
In line 26, you're assigning the value of an undefined variable callForHelp to variable choice. Also, There are no prompts.
4th Mar 2018, 3:24 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 2
Store all the options callForHelp, takeShortcut and wait into a single object. After line 30, add the prompt. Assign the input to a variable. Then do alert(obj[input]).
4th Mar 2018, 3:32 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar