Escaping Literal Quotes in Strings111

Escaping Literal Quotes in Strings111
0

#1

Tell us what’s happening:
I am stranding with the subject will any one help me?

Your code so far


var myStr = "I am a, \"double quoted" string inside "double quotes\"."; // 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/69.0.3497.100 Safari/537.36.

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


#2

Hey there,
You are not escaping all internal double quotes :slight_smile:


#3

Can you help to instruct e what it should be right way to do such challenge??


#4

Yes. You should escape EVERY INTERNAL double quotes. For example:

let text = "My name is \"Bruno\"";

In your answer you have escaped only the first and last double quotes, that’s the problem.
Was I clear?


#5

Tried everything i could but when i place the whole sequence i do not meet the right outcome


#6

Can you paste your final answer here?


#7

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


#8

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


#9

Your string should be this:

  • Start with " (marks beginning of string)
  • Contain the exact text string I am a "double quoted" string inside "double quotes". (but with each occurrence of " replaced with \" to escape it)
  • End with " (marks end of string)

No commas, no extra spaces, no semicolons.


#11

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

var myStr = “I am a, \” double quoted\"; \“string inside\”; \“double quotes\”." ; // To this

Note: It seems comments here are auto-escaped so ‘\’ (single slash) needs to be ‘\\’ (double slash) before it can be rendered.