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 trialZoe Xiao
7,195 PointsIs something wrong with this
var statement='She said"How\'s your family?"'; Why doesn't it work?
2 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Zoe,
You have the right idea it's just that your output doesn't match exactly.
You're missing a space after said
and you need to change your
to the
var statement='She said "How\'s the family?"';
Dan Mirda
3,992 PointsI think you may have missed a few escape characters:
var statement= 'She said \"How\'s your family?\"';
Hope that helps!
Zoe Xiao
7,195 PointsThank you Dan as well! Actually it does not matter if you just use a single slash...
Jason Anello
Courses Plus Student 94,610 PointsThat's correct. If you enclose your string with single quotes then you only have to escape single quotes.
Enclosing this string with single quotes requires less escaping than if you had enclosed it in double quotes because then you would have 2 double quotes to escape.
Zoe Xiao
7,195 PointsZoe Xiao
7,195 PointsThanks Jason You are right!