# Not able to figure out the question...Escape Sequences in Strings

Encode the following sequence, separated by spaces:
backslash tab tab carriage-return new-line and assign it to myStr

should i use the code from previous challenge or

var myStr;
how to assign backslash to the var ?

There is a diagram with everything explained on the challenge page :

Common escaped characters :
’ single quote
" double quote
\ backslash
\n new line
\r carriage return
\t tab
\b backspace
\f form feed

You need to assign a string to myStr using theses characters, delimited by a single space between each.

var myStr;

myStr = “\ \ \t \t \t \t \r \r \n \n”;

this is not working

got it working after some tweeks… thank you

1 Like

var myStr;
myStr = " \\ \t \t \r \n ";

but it didn’t work for me.

what’s wrong with this?

got it work after googling this https://github.com/FreeCodeCamp/FreeCodeCamp/issues/5828

What tweaks did you make? I tried the same code and it wouldn’t work. Thanks!

what is your code? so we can understand where you got stuck…

var myStr = “Here is a backslash: \.\n\t\t\r Here is a new line with two tabs.”;

you need to give spaces between each escape sentence

Thanks, that worked!

1 Like

var myStr = “Here is a backslash: \. \n \t \t Here is a new line with two tabs.”; // Change this line
Hello! Final code must look like this? I spend whole day trying to solve it, but it didnt work(

I can’t find a solution, can you help me guys?

this is my code:

myStr = ‘Here is a backslash: \ \t \t \r \n Here is a new line with two tabs.’;

Hey guys I figure it out like this

text: Here is a backslash: .
Here is a new line with two tabs.

answer: var myStr = “Here is a backslash: \.\n\t\tHere is a new line with two tabs.”;

Hope it works to someone else

What am I doing wrong?!

var myStr = “Here is a backslash: \ . \n \t \t Here is a new line with two tabs.”; // Change this line

When I c&p this code there were two backslashes behind: “backslash: -> \\ <-” Like so. (Im having to put three to get two to show up.

Hi…Not sure what you mean.

The problem requires one backslash to appear in the text followed by the period.

To do this then one additional backslash is needed immediately before the one you wish to appear.
\.
var myStr = “Here is a backslash: \.\n\t\tHere is a new line with two tabs.”;

hopefully that makes sense

Thanks.
I was trying to explain the correct answer to the original poster not say my code wasn’t working lol

have no idea how i added you, and your code worked perfectly sorry for the mix up, i took it down

No need for any sorry!
I’ll be the one saying sorry on the 10th time I ask for help in th future!!!