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 Combining Strings

mohammed mayat
mohammed mayat
4,228 Points

combining strings

after i enter name, message not printing out, https://teamtreehouse.com/workspaces/33981562

Link doesn't work. Will need more context! Posting the code will be helpful!

mohammed mayat
mohammed mayat
4,228 Points

index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="stylesheet" href="css/main.css"> <title>Using the prompt() method.</title> </head> <body> <div class="container"> <h1>Using the prompt() method</h1> <script src="combiningString.js"></script> </div> </body> </html>

combineString.js

var visitor = prompt('What is your name'); var message = 'Hello ' + visitor +". Welcome to treehouse."; message = message + "we are so glad that you came by to visit, "; message += visitor; message += " Plese come again, when you want to learn some more. "; document.write(message);

1 Answer

Victor Enriquez
Victor Enriquez
22,766 Points

After running your code in the console I can see the message printed in the current browser window. As an alternative you could print it to the console, or as an alert or inside a specific DOM Element.