could some one, please help.
Can you copy/paste the code into a reply, so we can see all your code?
When you enter a code block into the forum, remember to precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (
</>) will also add backticks around text.
Hopefully this improves the conversation.
I’ve yet to get to that problem but my guess is double quotes in other double quotes should be single quotes.
“I am a ‘string inside’ this code”.
Or: single quotes on the outside, and double on the inside; they can replace one another.
Might be a wrong, it has been a while.
Here is my code
var myStr = “I am a"double quoted"string inside"double quotes”.";
i have tried to not use the backslash and just use double quotes but it still would not run
If the title of the challenge is "Escaping Literal Quotes in Strings ", then you must use the backslash to pass this challenge. Can you show what you tried when you did use the backslash? Then I can explain why it did not pass when you tried it.
Works in a few circumstances, but not a general solution. What if your string contains both single and double quotes? What if your organization’s coding style guide and editorial style guide both require the same type of quotation marks?
Instead, you need to escape the quotes in the string. Escaping is simple: just put a backslash before the character.
"\"" // literal double quote '\'' // literal single quote '\\' // literal backslash var vultan1 = "\"Gordon's alive!\" - Prince Vultan"; var vultan2 = '"Gordon\'s alive!" - Prince Vultan'; vultan1 === vultan2; // true
Good response, makes sense. Cool. I’ve learnt something. Thanks.