Convert HTML Entities not working properly on FFC

Tell us what’s happening:

My code is working just fine on my PC but not on FFC

Your code so far


function convertHTML(str) {
  // :)
  let charCode = {
    "&" : "&​amp;",
    "<" : "&​lt;",
    ">" : "&​gt;",
    "'" : "&​quot;",
    "\"" : "&​apos;"
  }
  return str.split('').map(e => e in charCode ? charCode[e] : e).join('')
}

convertHTML("Dolce & Gabbana");

Your browser information:

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

You have hidden characters (\u200b Zero-width space), between “&” and the rest of the entity strings (from copy/paste). If you paste the code into the console on Chrome, they will show up as a red dot. You can also hover over them to see what it is.