I Dont understand it

So this is what i have var myStr = ‘I am a “double quoted” string inside “double quotes”.’;
And it wants me to You should use two double quotes ( " ) and four escaped double quotes ( \" ).

Variable myStr should contain the string: I am a "double quoted" string inside "double quotes". please help

The lesson teaches you how to escape. What have you tried. Just try and follow what the lesson teaches.
Post what you try here if it doesnt work.

What have you tried so far? What part did you get stuck on?

1 Like

myStr = ‘I am a “double quoted” string inside “double quotes”.’; thats what ive done so far

This is what the lesson says:

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.

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

You seem not to be using any backslashes anywhere in your code.

Actually your should be surrounded in backticks for it to be properly readable.

Oh i dont know what that is

Your string is inside single quotes (') not double quotes ("). You will need to escape your double quotes inside the string with the escape charcter (\).

A string is a data type in JavaScript. it is commonly wrapped around by either a single(’ ') or double (" ") quotation mark.
Assuming you have a variable which stores a string,

                           let variable='this is a string'

the computer will understand that it is just a string.
But if you want to quote something in the string above,

                    let variable='this "is" a string'

This will be confusing to the computer because it interpretes anything wrapped around by single or double quotation as a string. therefore, it will be seeing a string “is” inside another string which is not reasonable to it.
So to make the computer to understand that “is” is not a string, you have to place a backslash () before any quotation mark in a string. the variable above is written correctly as:

                  var variable='this \"is\" a string'

The computer will read this as:
this “is” a string

Notice the backslash coming before every quotation mark you dont want the computer to consider as a string.

please let us know if you are okay.

Just to be clear, what you are doing “works” in the sense that it gives the same result, but the lesson is trying to get you to do it a specific way.

These both produce the same string:

const str1 = 'I would "kill" for pie.';
const str2 = "I would \"kill\" for pie.";
console.log(str1 === str2);
// true

They create the same result. but this lesson is trying to make sure that you can do it the second way, with escapes.