Strings with Single Quotes

Tell us what’s happening:

Your code so far


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


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes/

Hi,

Remove double quote " " you putted a the bigining and end of your a tag.

Your code changed :

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

Hope this help !

Or,
you can also make use of template literals for your strings.
var myStr =`Your string here`;
This way you get to use both single quotes(’…’) and double quotes("…") in your string…
Hope this helps :slight_smile:

1 Like