Help with javascript code

Help with javascript code
0

#1

Yea hi i am workong on sequences with strings and the code i input is not working correctly. I input myVar=“FirstLine/n//SecondLine///Thirdline”; and i was wondering if i am doing it wrong or is the website not working properly whenever i hit run test it doesnt properly run.help!!


#2

Also i just tried the code
var myStr = "FirstLine\n\t\SecondLine\nThirdLine;\ and still nothing. Please respond


#3

First code is wrong: a forward slash is not a backslash.
Second code you aren’t escaping the literal backslash character, and you’ve added another backslash at the end of the string.


#4

Ok this time i put down var myStr = "FirstLine\n\t\SecondLine\nThirdline;". Still says running tests??


#5

It isnt accepting the quote still even with fixes


#6

you have a “;” in the code at the end of “ThirdLine;”
You also forgot to escape the “\” you need two of these in order to display one.
This code below should work. It passed for me.

var myStr = "FirstLine\n\t\\SecondLine\nThirdLine";

#7

Bad newa i used your code made all the changes nothing. I put it in exactly[quote=“Victor-Villacis, post:6, topic:231424, full:true”]

you have a “;” in the code at the end of “ThirdLine;”
You also forgot to escape the “\” you need two of these in order to display one.
This code below should work. It passed for me.

[spoiler]

var myStr = "FirstLine\n\t\\SecondLine\nThirdLine
-bad news i used exactly that nothing is working for me. It must be a bug i been stuck on this the past week. Even when yall helped. Its driving me insane :(

#8

It is just stuck at running tests again. No corrections or nothing. It sucks so bad


#9

@sickandghastly67 It really is not necessary to post a full working solution and it would be best if you did not in general to avoid spoiling it for others (blurred or not). I promise we will believe you if you just tell us you figured it out and passed the challenge tests. :smile:


#10

That def must be hard and its sad to hear. Don’t deter though, work through it. My suggestion would be to reset all the code. Refresh your page and even clear out the cookies of your browser. Log out and log back in if you have to.

Then work from the beginning line by line. Use your console to help you match the test case. Remember it is case sensitive. Go word by word, line by line. You got this lol


#11

I am trying to figure it out…problem is i put in the code properly this time and it isnt being accepted. How am i supposed to pass if it keeps doing running tests and not accepting it?


#12

can you screenshot and upload what you are putting in.


#13

Yea gimme a sec ill take a pic of it


#14

Based on your last code posted above, you are missing a double quote and semi-colon at the end. If you are still failing after fixing this, then you will need to post ALL of your code for us to see.


#15

so I am unable to screenshot but here is a link I provided to what I am doing https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings


#16

Hey guy so I finally got the code to work…I removed a bunch of cookies and it turns out It was affecting my computer…I feel incredibly dumb now. Thanks again and sorry for the mess


#17

Hey so I been putting in the code properly turns out I had a bunch of cookies I never deleted. Sorry again for the mess hope I didn’t ruin it for anyone


#18

great I am glad it worked out .