I am having trouble creating the quote

Tell us what’s happening:

Your code so farI


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

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 13421.89.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36.

Challenge: Escaping Literal Quotes in Strings

Link to the challenge:

You have a couple of issues:

The escape character, /, must come before the quotation mark.

All of your slashes except for one are backwards.

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

This slash needs to be reversed and match all of the other ones.

This is incorrect. The slash needs to come before the quotes like mentioned earlier.

Once you fix those issues then you have a spacing problem.

If you look at the console you should see this

Carefully examine your answer and compare it with the correct answer here

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

Make sure the spacing looks exactly like the correct answer.

1 Like
var myStr="I am a\"double quoted/" string inside/"double quotes/".";
var myStr = "I am a/ "double quoted/" string inside / "double quotes/".";

I’ve edited your post 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 (’).

You cannot have a space between the slash and the quotation mark.

var myStr = "I am a\"double quoted/"string inside/"double quotes/".";//change this line

it does not seem as if I put a space in front of the slash and the quotation mark

I’ve edited your post 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 (’).

You still have some of your escape characters (slashes) backwards.

which way is it supposed to be

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 myStr = "I am a\"double quoted\"string inside\"double quotes\".";\\change this line
var myStr = "I am a\"double quoted\"string inside\"double quotes\".";\\change this line

I’ve edited your post 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 (’).

Ok, now you need to fix this issue:

Is it possible that you could tell me the exact mistake I am making, because the console is still providing me with the slashes and quotations marks

What do you see when you run

var myStr = "I am a\"double quoted\"string inside\"double quotes\"."; //change this line
console.log(myStr);

(also, why did you change the direction of the slashes for the comment characters? Comments start with //.)

what are you trying to imply when you say “what do you see when you run”

var myStr = "I am a /"double quoted/"string inside/"double quotes/".";\\change this line