Freecodecamp: Goals are contradictory

Created on 25 Aug 2016  ·  4Comments  ·  Source: freeCodeCamp/freeCodeCamp

Remove all the backslashes ()
You should have two single quotes ' and four double quotes "
Only remove the backslashes \ used to escape quotes.

Challenge Quoting Strings with Single Quotes has an issue.
User Agent is: Mozilla/5.0 (iPad; CPU OS 9_3_3 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G34 Safari/601.1.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:


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



help wanted

All 4 comments

@marienhof thanks for the issue. I think we've had issues with this in the past (e.g. https://github.com/FreeCodeCamp/FreeCodeCamp/issues/8400).

The last test message could be rewritten to something like this

Change the string from double to single quotes but keep double quotes for the inner quotes.

@erictleung I think the third test should be combined with the first test if possible. The third test implies there are backslashes in the editor that don't escape quotes but there aren't. So if you remove all the backslashes (per the first test), you are fulfilling the third test.

I like @dhcodes idea. Let's merge the first and third test into one into something like this.

"assert(!/\\\\/g.test(code) && myStr === '<a href=\"http://www.example.com\" target=\"_blank\">Link</a>', 'message: Remove all the <code>backslashes</code> (<code>\\</code>)');",

I think that should still make it clear enough on what needs to be done to complete the challenge. If anyone finds a hole in the challenge, please comment. Otherwise, I'll mark this Help Wanted.

Updated via the PR above. Thanks for doing the hard part @erictleung

Was this page helpful?
0 / 5 - 0 ratings