Convert HTML Entities Correct Output but tests failed

Tell us what’s happening:

Hi,this is the same problem as Vighnesh1234 post which was posted about 24 days ago but only 2 replied and none solved the problem.My output is exactly identical to required results yet some tests fail !

Your code so far


function convertHTML(str) {
    // :)
    
     str=str.replace(/&/g,"&​amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&​quot;").replace(/'/g,"&​apos;");
     
  
    return str;
  }
  
  
convertHTML("Dolce & Gabbana");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

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

More than likely, you copied/pasted the replacement values rather than manually typing them out. It appears there are extra hidden characters from the coping that the tests are capturing and concluding your strings are incorrect.

true, i did copy the replacements from the test menu