Convert HTML Entities, Schindler's List test issue

Tell us what’s happening:
Does the test case with Schindler’s List works correct?
I’m checking my result in Chrome - it is the same as described.
Bun does not pass the test.

Your code so far


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

  return str
    .replace(/&/gi, symbolTable['&'])
    .replace(/</gi, symbolTable['<'])
    .replace(/>/gi, symbolTable['>'])
    .replace(/"/gi, symbolTable['"'])
    .replace(/'/gi, symbolTable["'"])
  ;
}

convertHTML("Dolce & Gabbana");

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 OPR/57.0.3098.106.

Even in working sandbox console if I type
console.log(convertHTML("Schindler's List") === 'Schindler&​apos;s List');
it gives true

Paste your codes inside here. There is a hidden character dot inside '&​apos;' remove it then paste it back in FCC and I guess you’ll be fine.

1 Like

Thank you a lot. I did see it in browser console too. the strange thing is it has even been there when i just copied the resulting string from test description.

now I deleted it and copied back to sandbox. I works as expected.

Thank you!

Glad it worked! Actually I had faced this problem before in the same way, pretty annoying I know :stuck_out_tongue:

I faced this problem today. I solved it. Thank to your solution. Can you explain why it has that annoying dot?

1 Like

It is a character hidden in the challenge text - it seems many people copied and pasted the same thing and it spreaded all over the Internet, you can find it in many websites

1 Like

Xin chào,

Those dots actually come from the challenge itself. You can try copying &​amp; in the challenge test suite then paste it in the browser console, you will see there’s an annoying red dot.

Well, I see that many people have faced this issue ever since, I just don’t know why FCC hasn’t done anything to get rid of those dots.

1 Like

It should be fixed if you check beta version of the website (FreeCodeCamp.rocks) it seems just that the small team have been busy with other things to deploy it

1 Like