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) Storing and Tracking Information with Variables The Variable Challenge Solution

Erika Green
seal-mask
.a{fill-rule:evenodd;}techdegree
Erika Green
Front End Web Development Techdegree Student 2,514 Points

Not sure what I did wrong here...

I am not sure what I did wrong in this code. Could somebody help me out?

If you see anything please let me know and any suggestions.

var name1 = prompt("Please enter a name.");
var animal = prompt("Please type an animal.");
var name2 = prompt("Please enter another name.");
var pluralNoun = prompt("Please enter a plural noun.");
var verb = prompt("Please enter a verb in the past tense.");
var adjective = prompt("Please enter an adjective.");
var noun = prompt("Please enter a noun.");

alert("You're all done!);

var sentence = "<p> There once was a boy named " + name1 + ". He had a friend who was a " + animal + " and his name was " + name2 + ". They found a treasure full of " + pluralNoun + ". So they" + verb + " back to their " + adjective + " town of " + noun + " with it."</p>;
document.write(sentence);
Samuel Webb
Samuel Webb
25,370 Points

Hey Erika,

I updated your formatting to make it easier to read. To make the code stand out, use three back ticks at the beginning and end of the code. The back tick (`) is on the same button as the tilda(~) which is usually at the top left of your keyboard. For more information on markdown formatting, check out the Markdown Cheatsheet located at the bottom of the comment and answer boxes.

2 Answers

Ian Seabrook
PLUS
Ian Seabrook
Courses Plus Student 14,085 Points

Hi Erika,

You're just missing some some closing quotation marks in your alert() function:

alert("You're all done!);

And around the closing paragraph tag in your sentence var:

var sentence = "<p> There once was a boy named " + name1 + ". He had a friend who was a " + animal + " and his name was " + name2 + ". They found a treasure full of " + pluralNoun + ". So they" + verb + " back to their " + adjective + " town of " + noun + " with it."</p>;
Erika Green
seal-mask
.a{fill-rule:evenodd;}techdegree
Erika Green
Front End Web Development Techdegree Student 2,514 Points

I added the closing quotes to the first one and changed the closing quotes around at the last one and my code works now...thank you very much!

Samuel Webb
Samuel Webb
25,370 Points

It looks like you missed the ending quotation marks in your alert() function.

Erika Green
seal-mask
.a{fill-rule:evenodd;}techdegree
Erika Green
Front End Web Development Techdegree Student 2,514 Points

Thank you! I will remember to do that next time to make it easier to read. I did add the quotes alongn with changing the quotes at the end and it worked!