freeCodeCamp Challenge Guide: Escaping Literal Quotes in Strings

Escaping Literal Quotes in Strings


Hints

Hint 1

  • When you need to use a special character such as " inside a string you need to escape it using \.

Solutions

Solution 1 (Click to Show/Hide)
const myStr = "I am a \"double quoted\" string inside \"double quotes\"."; // Change this line
31 Likes

var myStr = “I am a “doubled quoted” string inside “double quotes”.”; // Change this line

what’s wrong with this ?

7 Likes

what is wrong with this:

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

10 Likes

you put a space in front of the period, if you erase it, you will have the answer. Nice Job, Though!

10 Likes

I have the same issue. Resolved it yet?

5 Likes

It’s resolved, I misspelled quoted

8 Likes

Even I did the same too xD

1 Like

for anyone that didn’t get the correct answer. here ya go

71 Likes

Hey so I read over the comments but I’m still not understanding exactly what I did wrong. I have “I am a “double quoted” string inside “double quotes”.”;

6 Likes

Make sure you have the full stops and spaces where they are supposed to be :slight_smile: also include the backslashes like the example above.

2 Likes

i got the miss its the capitalize . .
right code >> var myStr = “I am a “double quoted” string inside “double quotes”.”;

wrong code >> var myStr = “i am a “double quoted” string inside “double quotes”.”;

4 Likes

Thank you ! I think it was a glitch because it says I completed that assignment now.

2 Likes

The following worked for me -

var myStr = “I am a “double quoted” string inside “double quotes”.”;

its not doubled its double u change that one …it will work

2 Likes

Correct ans: var myStr=“I am a “double quoted” string inside “double quotes”.”;

2 Likes

it still doesn’t work

2 Likes

They mean just as like in the example

var sampleStr = "Alan said, \"Peter is learning JavaScript\".";

I am a /"double quoted/" string inside "double quotes".
the / comes before " and then after the "

2 Likes

Correct

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

before the " and then after the " we place
so " "\

4 Likes