Escaping Literal Quotes in Strings- need some help

Tell us what’s happening:
can someone tell me what i did wrong and explain the purpose of this subject…
it’ s very unclear to me…

Your code so far

var myStr = "I am a \"double quoted\"."; // Change this line

Your browser information:

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

Challenge: Escaping Literal Quotes in Strings

Link to the challenge:

What do you see when you console.log(myStr) using this code?

Is it different than what you should see, according to the challenge instructions?

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

yes it is different… I’m not getting the right code…

console output
myStr = “I am a “double quoted”.”

i did exactly What they explained in the example… but i still wrong :tired_face:

Hi @tctq !

The correct output is this

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

You wrote this
I am a “double quoted”.

You are missing some text.

i try to wrote differently like you show me … but i still dont get the writ answer.
maybe i put the (’’) in the wrong place?
can you show me the rigth answer

Can I see your updated code?

var myStr ='I am a "double quoted" string inside "double quotes".';  // Change this 

The text is now correct.

The first change you need to make is to have double quotes on the outside like this

var myStr ="I am a "double quoted" string inside "double quotes".";  // Change this 

once you make that fix, then you need to escape the inner quotes.

That is what the lesson is trying to teach you.
Here is the FCC example again

\"Peter is learning JavaScript\"

Apply those backslashes \

and here

make sense?

1 Like
var myStr ="I am a \"double quoted\" string inside \"double quotes\".";  // Change this 

thank you so much!
sometime i feel so bad when i fail
but now I succeeded thanks to you! You’re great and i hope i can help you to someday…

1 Like

I am glad you were able to solve the problem :grinning:

You don’t have to feel bad about making mistakes.
That’s how we learn

1 Like

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