Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Foundations Strings Escape Characters

Challenge Task 1 of 3 - Strings - Javascript

Why isn't my string working? var escapedNewLine = "this is line 1\nThis is line 2"; var escapedBackslash = ""; var escapedTab = "";

4 Answers

Fernando Ramos
Fernando Ramos
4,369 Points

Poorly structured questions.... for those of you having issues on this challenge, this is what they want (it should not have been this hard if they worded it right or stated "Do not give an actual string sentence, just the properties for 'new line, escaped key, and tab key' within each blank quotes." Geez:

Challenge task 1 of 3 Set the 'escapedNewLine' variable to the string of a new line character. var escapedNewLine = "\n"; ..................

Challenge task 2 of 3 Set the 'escapedBackslash' variable to the string of a backslash character. var escapedBackslash = "\"; .....................

Challenge task 3 of 3 Set the 'escapedTab' variable to the string of a tab character. var escapedTab = "\t";

Hi Ibraheem,

The challenge wants the string to be only the escaped newline. You can't add in extra characters

Erik McClintock
Erik McClintock
45,783 Points

Ibraheem,

As Jason says, the issue here is in the way that this particular code challenge task is phrased, not in how you're writing your new line escape character itself.

It is looking for you to literally and simply set the var escapedNewLine equal to what the escape new line character is, not to create a string that uses the escape.

Hope this helps to clarify!

Erik

if you follow the 2nd answer of Fernando Ramo's, the first answer will no longer be correct so here is what you do:

1) "/n" 2)"//" 3)"/t"