Why does my solution to this project not work?

Hello everybody , Why does my solution to this project not work?

Your code so far


var myStr = "I am a \"double quoted\" string inside \"double quotes\".";

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 OPR/78.0.4093.214

Challenge: Escaping Literal Quotes in Strings

Link to the challenge:

What error message do you have?

Hey Jeremy , there is no error message. The code is simply not doing what I intended to make it do (sorry if that sounds silly)

My code -

 var myStr = "I am a \"double quoted\" string inside \"double quotes\".";

My output - myStr = “I am a “double quoted” string inside “double quotes”.”

Output required for the project - I am a “double quoted” string inside “double quotes”.

So… If there is no error message, then your code is fully passing?

It looks correct to me?

I tried to do the same challenge.
SOLUTION REDACTED
this passed the test, if not working Reset all code and replace the code in the input box with your code

Oh wow! Yes indeed it passed the project tests. Sorry , I misunderstood what it asked

yes indeed! Just did that a while ago. Thanks

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

I appreciate your efforts in making forums a better place for us. I saw he already solved the problem but there is a bug in the built-in editor, I just wanted to share code for him to make sure it’s not that his code is wrong.

Those types of things can occur in the future as well, I recommend you to use vscode or any type of text editor along with freeCodeCamp’s built-in editor as challenges grow more complex it would be much easier for you to edit your code and also when this type of things happens you just don’t rely on your clipboard.

I agree that learning a code editor is helpful in the long run, but I don’t think OP’S problem had anything to do with an editor whatsoever. It was just a misunderstanding of the directions, which happens to all of us from time to time.

1 Like

yes indeed! I already use vs code and solved all the responsive web design. Thank you for your suggestion and your help

alright guys i managed to complete this project! Thank you so much Jeremy and Russell for your help.

Happy Coding everyone!
:slight_smile:

1 Like

I tried your code in an online compiler for me it gives your required output without a problem. But you can also try the below method to for strings without using / symbols all over your string.

type or paste code here
 var myStr = `I am a "double quoted" string inside "double quotes".`;
 console.log(myStr);

Also in modern javascript developers doesn’t use var for declaring variables. Instead of var developers use let and const for declare variables.

type or paste code here
 const myStr = `I am a "double quoted" string inside "double quotes".`;
 console.log(myStr);

Hey isuru! Thank you for your time. Yes indeed I am aware of modern js standards and the scoping issues that var has. I was just trying to solve the challenge at the time. Thank you so much for your help!
Happy Coding :slight_smile:

1 Like

The challenge specifically asks the user to use escaped double quotes. If you are unsure of the requirements of challenges the users are completing, typically there is a link you can click and read in the first post.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.