Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables Combining Strings

Need help over here!

is there anything wrong in this?

var visitor = prompt ('What is you name?');

var Age = prompt('how old are mister');

var messeage ="hello to tree house " + visitor +are you Age;

document.write(messeage);

bhuwan shrestha
bhuwan shrestha
Courses Plus Student 8,489 Points

Hi John, On line 3 you are concatenating string with variable. since {are you} is a string you have to put this inside "" and separate from variable Age using + sign. So you can correct your code like following: var messeage ="hello to tree house " + visitor +"are you"+ Age;

Chris Bryan
Chris Bryan
3,654 Points

Try this

var visitor = prompt ('What is your name?'); var age = prompt ('How old are you mister?'); var message = "Hello to treehouse " + visitor + " you are " + age + "."; document.write(message);

2 Answers

Steven Parker
Steven Parker
221,322 Points

It looks like you're missing some punctuation.

You forgot to put quotes around the string " are you ", and you need a plus sign (+) between that and the variable Age.

You also misspelled "messeage" (with an extra "e"), but since you did it consistently it should not be a problem.

thank you Steven!

Thank you joseph Frazer!