yuliz
January 26, 2021, 4:14pm
1
Tell us what’s happening:
I have tried like for one hour and there is not happening.
Your code so far
var myStr = “I am a /“double quoted/” string inside /“double quotes./”;”
var 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/88.0.4324.96 Safari/537.36 Edg/88.0.705.50.
Challenge: Escaping Literal Quotes in Strings
Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
Hi and welcome to the forum!
You are making a string, so the contents must be surrounded by double quotes. But this string contains quotes, so the internal quotes need to be escaped (which you have done).
Your string is not inside double quotes.
Also, look again at what the escape character is.
1 Like
yuliz
January 26, 2021, 4:24pm
4
I have tried double quotes at the beginning and end plus the escape before and after the double quotes inside. I have deleted them, is not happening.
You cannot have a string without opening and closing ". You must surround your string with ",
yuliz
January 26, 2021, 4:27pm
6
SyntaxError: unknown: Unexpected token, expected “;” (1:22)
this is what appears.
Please post your current full code.
yuliz
January 26, 2021, 4:28pm
8
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 (').
As @ArielLeslie said, your escape character is not correct:
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.
system
Closed
July 28, 2021, 4:31am
10
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.