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

Kieran Corcoran
Kieran Corcoran
11,188 Points

Java Basics

Hi,

Sorry, real beginner!

Can anyone tell me why this code is not correct? I am trying to combine variables.

var firstName = "Peter"; var lastName = "Smith"; var fullName = firstName + lastName;

Kieran Corcoran
Kieran Corcoran
11,188 Points

Hey,

Thank you for the quick responses, I was not adding the space. I could have been there a life time and not figured that out!

Thanks again.

3 Answers

Jack Choi
Jack Choi
11,420 Points

Maybe it wants you to have a space between the first and last names?

var fullName = firstName + " " + lastName;

Edit: also Java and JavaScript are very different languages!

Valentin Berlin
Valentin Berlin
14,346 Points

When you're saying it's not correct, how does this show?

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Hi Kieran Corcoran

When something goes wrong in a code challenge make sure you look in the bar that appears directly above the area you type the code in. It turns red when there's a mistake and you can usually find an error message that can help you figure out what went wrong. For example, when I tried the code challenge using your code I got this message:

"Don't forget to add a space between your first and last name."

Also, watch the end of the first video again: Java is not JavaScript. They are two very different programming languages.

Kieran Corcoran
Kieran Corcoran
11,188 Points

Hi Dave,

Thanks for the heads up. I saw the error but I clearly had brain freeze!

PS This is a brilliantly delivered course. Keep up the good work!!!