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 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"