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 trialJeff Lange
8,788 PointsAm I using the "\" to escape incorrectly?
Alright, so this seems like a pretty straightforward code challenge. They say:
In 'strings.js' file define a string called 'statement' with the text of - She said "How's the family?"
Simple enough. I write this:
var statement = 'She said, "How\'s the family?"';
However, it gives me this error:
Bummer! You've the string [sic] is the incorrect value remember to use \ before the " or '.
Am I doing something wrong or is this a bug in the website?
4 Answers
Michelle Pepe
Courses Plus Student 6,125 Pointsvar statement = "She said \"How's the family?\""; console.log(statement);
Jeff Lange
8,788 PointsAfter refreshing and putting the same answer in each time, it finally accepted it. Looks like there's some sort of bug on that question.
Cristian Cereseto
9,627 Pointshow you answer it works, but i think it's asking you to escape also the double quotes characters
Jeff Lange
8,788 PointsI did try that earlier, but it didn't like that either. It MIGHT have been that I had a comma in there ("She said," vs "She said"), but that shouldn't have returned an error with the backslash, since those characters don't actually contact each other.
Thanks for dropping in to help! :)
Jason Anello
Courses Plus Student 94,610 PointsHi Jeff,
It's most likely the comma. Unfortunately error messages don't always match up with what's wrong.
Cristian Cereseto
9,627 Pointsno problem! glad you could tackle it ;)