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 trialRay Dunbar
7,367 PointsNot getting second line to show correctly when previewing.
I am typing what is shown on screen but when I refresh the preview it will only show the name typed into the prompt and not "Hello". What am I missing?
var visitorName = prompt('What is your name?'); var message = "Hello " + visitorName; document.write(visitorName);
1 Answer
Steven Parker
231,222 PointsThe last line is writing the contents of "visitorName", but the combined string is in "message".
Ray Dunbar
7,367 PointsRay Dunbar
7,367 PointsThank you! I honestly don't know how I missed that. I must have looked at it a thousand times.