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

Sean Flanagan
Sean Flanagan
33,235 Points

My solution to The Variable Challenge

var adjective = prompt("Please type an adjective");
var verb = prompt("Please type a verb");
var noun = prompt("Please type a noun");
document.write("There once was a ") + adjective + verb + (" who wanted to change ") + noun;
alert("You're done!");

Please comment and critique.

Thanks.

1 Answer

Hey

Ran you code through JS console and the document.write only put "There once was a " to the screen.

Try moving the () around a little ; maybe something like this:

document.write("There once was a " + adjective + verb + " who wanted to change " + noun);

Sean Flanagan
Sean Flanagan
33,235 Points

Hi Marc. I did what you suggested and it worked a treat.

Thanks.

Sean :-)