Convert HTML Entities - Need help

Tell us what’s happening:

The code works fine for me but apparently the compiler does not accept my code.

Your code so far


function convertHTML(str) {
  // :)
for (var i = 0; i < str.length; i++) {
    switch (str[i]) {
      case '&':
      return str.replace('&', '&​amp;');
      break;

      case '<':
      return str.replace('<', '&​lt;');
      break;

      case '>':
      return str.replace('>', '&​gt;');
      break;

      case '"':
      return str.replace('"', '&​quot');
      break;

      case "'":
      return str.replace("'", "&​apos;");
      break;

      case '<>':
      return str.replace('<>', '&​lt;&​gt;');
      break;

      case 'abc':
      return str;
      break;


    }
  }

  return str;
}

convertHTML("Dolce & Gabbana");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/convert-html-entities

Try manually typing the replacement characters. If you copied and pasted them in, it is possible the source you copied them from has some extra hidden characters which the tests are picking up on.

Oh i see. Thanks for the tip.