Basic JavaScript - Escaping Literal Quotes in Strings

Tell us what’s happening:
Describe your issue in detail here.
it says variable myStrg should contain the string , and I don’t know what’s wrong
Your code so far

const 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/ Safari/537.36 Edg/107.0.1418.26

Challenge: Basic JavaScript - Escaping Literal Quotes in Strings

Link to the challenge:

add this line at the bottom of your code section:


And look at the result in the console area.
You probably have the wrong spacing in the string.

I added the console.log(myStr) and still won’t let me go through I even fixed the spacing and still nothing.

what does your new code look like?

1 const  myStr = "I am a \" double quoted\" string inside \" double quotes\"."; // change this  line
2 console.log(myStr);
mod edit: solution redacted

This code works fine and returns:

I am a "double quoted" string inside "double quotes".

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

hi there, please watch out for sharing code solutions in the forum… (I know you know but the previous post contained a solution).

this code seems to have too many spaces.
What does your console.log return when you try to log it?

Hi. I have forgotten completely the rule in this case. Multitasking is not the best idea obviously :slight_smile:. I will pay more attention next time. Thank you for letting me know this.

so, I run the test and the double quotes, and the back lashes are correct it gives me the check sign that, that part is good but what’s wrong its saying myStr should contain the string.

Please try and pay attention to the details.

Here is the output from the log vs the expected output

Expected string:

I am a "double quoted" string inside "double quotes".

// tests completed // console output

I am a " double quoted" string inside " double quotes".

Clearly there are too many spaces in the string you are making. So you just need to fix this to match the expected string exactly.

Thank you for your help I appreciate it

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.