Escaping Literal Quotes in Strings2

Escaping Literal Quotes in Strings2
0

#1

how can i write the literal quotes in string?

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


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

var myStr="I am a\"double quoted \string inside\"double quotes\".";
console.log('myStr');

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

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


#2

Step 1: Assign an empty string to a variable like this
var myStr = "";
Step 2: Write anything in between those double quotes like this
var myStr = "I am a "double quoted" string inside "double quotes".";
Step 3: Place a \ just before any quote you find like this
var myStr = "I am a \"double quoted\" string inside \"double quotes\".";
and you shall pass!


#3

Ah ok thank you :slight_smile: I got it !