Convert HTML Entities don't pass on 2 tests

Convert HTML Entities don't pass on 2 tests
0
#1

Tell us what’s happening:
Can’t pass on 2 tests, but it seens that the code is returning the right awnser

Your code so far


function convertHTML(str) {
  let htmlEntities = [
    ["&","&​amp;"],
    ["<","&lt;"],
    [">","&gt;"],
    ["\"","&​quot;"],
    ["\'","&apos;"]
  ];
  
  htmlEntities.forEach( (v) => str = str.replace (new RegExp(v[0],"g"),v[1] ) )   

  return str;
}

console.log(convertHTML('Dolce & Gabbana'));
console.log(convertHTML('Stuff in "quotation marks"'));  

Your browser information:

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

#2

Try deleting and retyping the html entities, there may be an invisible character in there

#3

It worked! Probably a char enconding problem. Thanks you! :smile: