I can't crack this topic for some reason, please help!

Tell us what’s happening:

Your code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36.

Challenge: Escaping Literal Quotes in Strings

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings

did you wanted to write I am a"double quoted"string inside"double quotes".?

hint: spaces matter

1 Like

yes i do, i think i tried several ways but still got stuck

Show us your latest version.

Tell us what’s happening:

Your code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36.

Challenge: Escaping Literal Quotes in Strings

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings

You are close. You have one extra space that should not be there and you are still missing a space character after one of the double quotes.

where is my one extra space? can you please pointed out for me

With the above code, myStr looks like below:

I am a "double quoted "string inside "double quotes ".

and it should look like:

I am a “double quoted” string inside “double quotes”.

You’d probably get it right if you started over, set it back to the original backslash-missing starter string, and then carefully put in the backslashes before the quotes without touching the space bar or backspace keys. That might be the easiest way. But if you want to count spaces:

// You need this one below
var myStr = "I am a \"double quoted\" string inside \"double quotes\".";
var myStr = "I am a \"double quoted \"string inside \"double quotes \".";
// But you have that ^

i got it, thank you guys for all your help. you’re the best!

1 Like

thank you for your help