Quoting Strings with Single Quotes - cannot find error

Tell us what’s happening:
My answer here below. I’ve checked in another post which mentions the same answer as correct by 3 different users. Yet FCC does not accept as the answer. Could someone pls tell me what’s wrong? Thx!

Your code so far

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36.

Link to the challenge:

Remove the initial statement as this worked for me:

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

1 Like

Thx Alex it worked! I was reading on a post about another challenge someone had the same issue. Bad bug on FCC it leaves you wondering about the answer when in fact it has nothing to do with it…

The test is expecting you to just change the original line (the instructions do reflect this) and not add an additional line. Could the test be more robust? Possibly, but it is difficult to guess at all the ways in which campers may try to write their code for certain challenges. That is why the instructions will be very specific sometimes and/or you will see comments in the code section that might state “Do not change anything below this”. As you get to the later JavaScript challenges, you will see the challenge tests only have to check if the answer is “correct” vs looking for a certain way it is formatted (which this challenge was trying to teach).

1 Like

When I got to the next challenge there was indeed an explicit instruction saying “change this line”. So I went back to the challenge in question to check if the instruction was there and I had missed it. It is not. I think they have missed entering the instruction text in this challenge although the format is being checked.

1 Like