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 Create a Variable

Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

correct answer?

Can someone point out the correct answer for the second step of the chalenge (Assign your name (as a string) to the myName variable.)?

Thx!

4 Answers

Hi Silvia

It basically ask your name to assign ("=") as a String (for example- "Silvia") and then add semi-coma in the end. :)

Assign your name (as a string) to the myName variable.

var myName = "Silvia";
Chase Marchione
Chase Marchione
155,055 Points

To assign your name as a string (a literal sequence of characters), you would use quotation marks to define the beginning and ending of the string.

The equals sign is the assignment operator, which indicates that you are assigning a value to the variable.

A semi-colon at the end of the statement indicates that your command is finished at the point it is used.

Example code (of course, you'd want to use your own name instead of 'firstname lastname':

var myName = "firstname lastname";
Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

Thank you for the answers, I tried that multiple times but I got an error. It means it's gotta be a problem with the workspace or something.

If that happened, one way is to refresh it repeatedly and type again. It will sort out everything after refresh or use different browser.

Chase Marchione
Chase Marchione
155,055 Points

A refresh might be all you need to do, though it is more than likely that it is some sort of temporary issue with the objective--this happens from time and time. Sometimes it takes minutes or even just seconds for the issue to be solved.

Hi Silvia,

What kind of error are you getting? I just tried the challenge and it's working correctly at this moment.

Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

Hey Jason Anello,

I switched to another browser and it worked in the end. Thx for the intervention :).