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

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

#1

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

var myStr = \‘Link’;

should i use the code from previous challenge or

var myStr;
how to assign backslash to the var ?


Escape Sequence Javascript
#2

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.


#3

var myStr;

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

this is not working :frowning:


#4

got it working after some tweeks… thank you :slight_smile:


#5

my answer is

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

but it didn’t work for me.

what’s wrong with this?

Could somebody help,thanks in advance.


#6

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


#7

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


#8

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


#9

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


#10

you need to give spaces between each escape sentence


#11

Thanks, that worked!


#12

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(


#13

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.’;


#14

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


#15

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


#16

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.


#17

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 :slight_smile:


#19

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


#20

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


#21

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