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 Foundations Strings Basics

Chen Coello
Chen Coello
862 Points

I don't get it.

What do I do? Either it says "You didn't define the blasted variable" or "You've the string is the incorrect value remember to use \ before "or'.

3 Answers

Hi Chen,

I'm going to guess the reason you're not passing the challenge is the quotation marks. Remember they have be in pairs in the correct order. So, if you need quotation marks in your sting to make it grammatically you may have to escape () a quotation mark so JavaScript doesn't get confused. The line She said "How's the family?" is to be assigned to the variable statement. Look at the code below and study the quotation marks. Note the quotation marks before the semicolon, a double quote (") followed by a single quote (').


var statement = 'She said "How\'s the family?"';
Chen Coello
Chen Coello
862 Points

Thanks a lot. That one was hard.

Can you post the question along with your code?

Wild stab in the dark (because I had the exact same problem!) is that you're missing a second backslash, because the quotemarks are right at the end of the string it isn't so obvious?

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