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

works in console but not in challenge

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

Each case above works fine in the console but receives errors during the challenge. What did I miss?

2 Answers

Stone Preston
Stone Preston
42,016 Points

looks like you might have a space at the very end of the string. try

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

whereas you had

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

notice the space at the end between the last " and ';. Thats whats causing it to fail

Hi Chris,

For future reference, since you wrapped the string with single quotes you only have to escape the single quote.

Thanks, that makes sense.