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 Review Concatenation

davide totaro
davide totaro
5,559 Points

Complete the code below to create a new variable named message containing the string "JavaScript"

???

7 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Right, I've seen the question and I've seen why your attempt isn't working.

The question is using concatenation in it's example so it's done the "Script" part of the value for you. but you also need to include the quotes for the string so it's more like

var message = "Java" + "Script" 

where the text you want to type is message and "Java".

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Without seeing the question itself

I would hazard an educated guess the code you want is

var message = "JavaScript";
davide totaro
davide totaro
5,559 Points

ok thanks so much for your time

It's just "Java"

davide totaro
davide totaro
5,559 Points

it doesn't works, i don t know why

Remember: Since it's a string you are adding don't forget the quotes, to the word 'Java' and you have to stick to the same type TreeHouse shows on the example, TeamTreeHouse tends to be a case sensitive platform as for my experience. The only way it worked for me was when I used: 'Java'

var message= "Java" + 'script'; . I worked for me

Anyone else have trouble with this one? It looks incredibly simple, but I keep getting it wrong.

I initially entered 'Java' and got it wrong. Then I just entered Java by itself with no quote marks and got it wrong again.

THEN knowing it wouldn't work for any reason, I entered in 'Java'; with the semi-colon just see what would happen and sure enough, wrong again.

I have not tried "Java" with double quotes yet. If that appears to be the right answer, can someone explain why double quotes is the right answer over single quotes? Felt like JS ignored that rule when concatenating.