Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Working With Numbers The Mad Libs Challenge Revisited

My prompt isn't showing. Could someone review my code please.

var questions = 3; var questionsleft = ' [' + questions + 'questions left]'; var adjective = prompt('Please type an adjective'= questionsleft); var verb = prompt('Please type a verb'); var noun = prompt('Please type a noun' + questionsLeft); alert('All done. Ready for the message?'); var sentence = "<h2>There once was a " + adjective; sentence += ' programmer who wanted to use JavaScript to ' + verb; sentence += ' the ' + noun + '.</h2>'; document.write(sentence);

Luc de Brouwer
seal-mask
.a{fill-rule:evenodd;}techdegree
Luc de Brouwer
Full Stack JavaScript Techdegree Student 17,939 Points

Hi Christina,

You're doing a great job on this one, however you're confusing a few important concepts. You're mixing up how string concatenation works and when an expression should be ended with an ';'.

My advice for properly formatting your question would be to use the markup style sheet that treehouse provides when you ask a question. three ` 's at the beginning will start a code block and add 3 ` 's at the end will create a block that will show your code in a readable format unlike how it is displayed in one single line if you don't format your code.

Like this:

var questions = 3; 
var questionsleft = ' [' + questions + 'questions left]'; 
var adjective = prompt('Please type an adjective'= questionsleft); 
var verb = prompt('Please type a verb');
var noun = prompt('Please type a noun' + questionsLeft); 
alert('All done. Ready for the message?'); 
var sentence = "<h2>There once was a " + adjective;
 sentence += ' programmer who wanted to use JavaScript to ' + verb; sentence += ' the ' + noun + '.</h2>'; document.write(sentence);

Can you figure out what is going wrong now? If not, please send me a message

1 Answer

Hey i know this answer is really late but i figured why not. In your markup for the first prompt you have the string in quotes then an equal sign to questionsleft. Instead of an equal sign it should be a + sign.

so var adjective = prompt('Please type an adjective'= questionsleft); should be var adjective = prompt('Please type an adjective' + questionsleft);

So the prompt command is returning the string 'please type an adjective and the string used for the questionsleft variable. I hope I explained this correctly. Im still new to Javascript so I'm learning also. If anything is wrong here please feel free to correct me.