What's wrong with this I don't understand

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

The backslash goes before the character you want to escape.

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 (’).

It looks like you have a few ‘smart quotes’

You want regular quotes "

2 Likes

I have seen those “smart quotes” show up from time to time when I copy and paste. You have to have an eagle eye to spot them.

The smart quotes typically appear when the user pastes into a post without first using the triple back ticks. Without the back ticks, they get converted and then when the triple back ticks are added after the fact, the smart quotes remain.

1 Like

That or they appeared in the code in the first place. Apple devices are particularly bad about changing quotes to smart quotes in code.

1 Like

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