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 trialNick Yates
8,621 PointsMy code is exactly like that in the video but its not working at all?
this is my code
"<h2>There once was a [adjective] programmer who wanted to use JavaScript to [verb]the [noun].</h2>"
var adjective = prompt('Please type an adjective');
var sentence = "<h2>There once was a " + adjective;
var verb = prompt ('Please type a verb');
var noun = prompt ('Please type a noun');
alert('All done. Ready for the message?');
sentence += ' programmer who wanted to use Javascript to ' + verb;
sentence += ' the ' + noun + '.</h2>;
document.write(sentence);
2 Answers
Nick Yates
8,621 PointsThank you!! that was it!
Charlie Knight
4,338 PointsIf you use the console window (press F12 in Chrome) to debug the script you'll notice a fatal exception "Uncaught Syntax Error: Invalid or unexpected token" on line 10.
You've missed an ending ' on the last sentence line
Change: sentence += ' the ' + noun + '.</h2>;
into: sentence += ' the ' + noun + '.</h2>';