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

Escape String Newline Challenge May Be Broken

The instructions to the first Escape String challenge are: "Set the 'escapedNewLine' variable to the string of a new line character."

My code reads: var escapedNewLine = "It's newline time \n Newline time is over.";

The console keeps telling me to recheck my work - "Your string is not right. Try a backslash followed by an n."

I'm not sure what I'm doing wrong.

Thanks!

3 Answers

You have excess word's in your escapedNewLine variable. The value it is looking for is "\n". The code challenge is most likely doing a string comparison of your answer verses an answer key with a vaule. In other words the program is asking "Does "It's newline time \n Newline time is over." === "\n"?", and that is why it is returning an error.

I"m working the same as her and I kept getting the same error, but i have to "\n" just right the end of the word before

var escapedNewLine = "Line One\n LineTwo\n Line Three";

The challenge is only looking for the new line character. If you put in anything other than \n it will not pass. The first line of code should look like this: `` var escapedNewLine = "\n";