Basic JavaScript - Escaping Literal Quotes in Strings

Tell us what’s happening:
I keep trying to manipulate this in a way that uses multiple double quotes. It’s not working. This is not the first or even the 7th attempt. I don’t know what it wants me to do … Someone please help clarify. I need you!

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/102.0.5005.63 Safari/537.36 Stream Master

Challenge: Basic JavaScript - Escaping Literal Quotes in Strings

Link to the challenge:

In some places you wrote "\ and in others you wrote \", but only one of those is correct.

i didnt change const into var and that’s what was getting me hung up

That’s all irrelevant. The string you wrote is incorrect. You need to escape all of the double quote characters inside the string by writing a backslash immediately before them.

i see where you are pointing out but it wouldn’t pass it until i changed it to var.

I’m sorry, but you’re incorrect. This problem is not about declaring variables, and so the keyword you use to declare myStr is irrelevant. You can use var, or you can use let, or you can use const. The problem was your string. You did not escape the quotes properly. Since learning to escape quotes properly was the goal of this lesson, I suggest you go back and try to solve it again (without looking up outside help).

Make sure that you have the backslash in front of the quote.

\" ← this is correct

"\ ← this is not correct

i had the first test correct at one point and not the second. So i kept trying to fix the first one … then i realized i’m a dud and fixed the second which specified var.

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