freeCodeCamp Challenge Guide: Quoting Strings with Single Quotes

freeCodeCamp Challenge Guide: Quoting Strings with Single Quotes
0.0 0

#1

String values in JavaScript may be written with single or double quotes, so long as you start and end with the same type of quote. Unlike some languages, single and double quotes are functionally identical in JavaScript.

"This string has \"double quotes\" in it"

The value in using one or the other has to do with the need to escape quotes of the same type. If you have a string with many double quotes, this can be difficult to read and write. Instead, use single quotes:

'This string has "double quotes" in it. And "probably" lots of them.'


#2

but this is way different from it this one is asking about to correct the website


#3

I’m not sure you’re able to complete the challenge as is.

Example:
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";

Correct Solution:
var myStr = "<a href='http://www.example.com' target='_blank'>Link</a>";

This condition is not fulfillable:

You should have two single quotes ’ and four double quotes "


#4

it still didn’t work I just got the first one right


#5

var myStr = “Link”;
This is not working for me :frowning:


#6

var myStr = '<a href="http://www.example.com" target="_blank">Link</a>';

This is my code. And it is correct.


#7

Thanks, that clarified my general misunderstanding with that section.


#8

thank you it worked.