freeCodeCamp Challenge Guide: Escaping Literal Quotes in Strings

freeCodeCamp Challenge Guide: Escaping Literal Quotes in Strings
0

#1

In JavaScript, you can escape a quote from considering it as an end of string quote by placing a backslash \ in front of the quote.

"Alan said, \"Peter is learning JavaScript\"."

This signals JavaScript that the following quote is not the end of the string, but should instead appear inside the string.

However another option is to alternate quotation marks if possible.

'Alan said, "Peter is learning JavaScript"'

this would also work.


#2

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

what’s wrong with this ?


#3

what is wrong with this:

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


#4

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


#5

I have the same issue. Resolved it yet?


#6

It’s resolved, I misspelled quoted


#7

Even I did the same too xD


#8

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


#9

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”.”;


#10

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.


#11

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”.”;


#12

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


#13

The following worked for me -

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


#14

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


#15

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


#16

it still doesn’t work