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

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
231,275 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!