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

General Discussion

Web Design Track JavaScript Strings Basic Objective

Hi, I am having a problem with one of the objectives. It is under the JavaScript Foundations deepdive under the webdesign track. Then under the strings stage it is the first "Basics" objective. The code I put in is: var statement = 'She said "how\'s the family?"'; console.log(statement); It keeps giving me the message: "Bummer! You've the string is the incorrect value remember to use \ before the " or '." I have tried multiple ways of escaping the quotes and to no avail. This should be correct. I don't know why it is not. Thanks. -Curtis

5 Answers

You have to write it like this statement = 'She said \"how\'s the family?\"';

Think your doing the escaping right, try using a capital H on how and it should work. Think the editor may be case sensitive.

I tried that, didn't work either. I think there is a bug in the script that checks the answer.

Well that makes me feel stupid lol. Yes it was the capital H. Thanks

Lol its always the little errors like this that make you pull your hair out! Sometimes it helps to have someone look at it from a fresh perspective. Glad you got there in the end though :)

EDIT: Just to note both

var statement = 'She said \"How\'s the family?\"'; 

and

var statement = 'She said "How\'s the family?"';

work for the challenge. Perhaps someone with more JS knowledge can tell us if one of them is 'more right' than the other?