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 trialMark Lovett
15,853 PointsThis one appears to be broken
It doesnt like this code:
var escapedNewLine = 'This is a\nbrand new line'; console.log(escapedNewLine);
3 Answers
Mark Lovett
15,853 PointsThis is what they want: \n
Ok. Thanks much!
Jason Anello
Courses Plus Student 94,610 PointsHi Mark,
You have to take the instructions literally.
For task 1, it says "Set the 'escapedNewLine' variable to the string of a new line character."
All that should be in your string is the new line character. Not all the extra text that you have.
Also, the conole.log
statement isn't requested in the instructions. Not sure if it will pass with them in.
It will also pass with single quotes.
James Barnett
39,199 Points>
All that should be in your string is the new line character. Not all the extra text that you have.
This is a tough call. I'm tempted to say this should be reported as an overly specific code correctness check.
Jason Anello
Courses Plus Student 94,610 PointsI don't know.
I would think that the instructions would have to be something like "Set the 'escapedNewLine' variable to a string with a new line character in it." in order to indicate that it would be ok to add extra characters of your choosing if you wanted to.
I suppose you could tag whose in charge.
James Barnett
39,199 PointsI suppose you've got a point there.
James Barnett
39,199 Points>
Also, the console.log statement isn't requested in the instructions. Not sure if it will pass with them in.
It will.
J Andrew Scott
30,626 PointsIt's probably because your'e using single-quotes. Typically, the only escape sequences that work inside single-quotes are other single-quotes \'
and backslashes \\
.
Try it with double-quotes instead.
var escapedNewLine = "This is a\nbrand new line";
console.log(escapedNewLine);