Why my code doesn't work on FreeCodeCamp page?

Hello everyoane :slightly_smiling_face:
I have a problem with exercise about convert HTML entities.
This is my code:

function convertHTML(str) {
    let entities = {
        "&": '&',
        "<": "&lt;",
        ">": "&gt;",
        "'": '&​apos;',
        '\"': '&​quot;'

    let regExp = /[^\w\s]/g

    return str.replace(regExp, function (match) {
        return entities[match]


convertHTML('Stuff in "quotation marks"')

everything works perfect in Visual Studio Code and Chrome Console on FCC page, but i can’t set the exercise conditions with 'Stuff in “quotation marks” ’ and “Schindler’s List” as true

code from Get a Hint page works ok but i can’t understand why, on first look code do the same things

You have hidden characters in the last two property values, re-type them in manually.

"'": '&​apos;',
'\"': '&​quot;'

:joy: realy ? so simple ?

Yes, and trust me you are not the first with this issue. I just made a PR for this challenge to add a notice about the problem. I think it is needed.

1 Like