Convert HTML Entities - Don't know If the problem lies with me or FCC

Tell us what’s happening:
Hello guys,

I don’t seem to understand what’s going on at my end here. I have tried submitting this code but couldn’t. My code seems pretty okay. I have even tried submitting the codes in the “Get a hint” section to see if it is from my code but all of the solutions were also rejected! So it is pretty strange to me. Someone should please look into it to see where the problem lies.

Thanks you.

Your code so far

function convertHTML(str) {
  // :)
  var regex = /[&<>""']/g;

  //var newStr = str.split('');

  var newStr = str.replace(regex, function(check){
    if(check === '&'){
      return '&​amp;';
    else if(check === '<'){
      return '&​lt;';
    else if(check === '>'){
      return '&​gt;';
    else if(check === '"'){
      return '&​quot;';
    else if(check === "'"){
      return '&​apos;';
  return newStr;

console.log(convertHTML('Hamburgers < Pizza < Tacos'));

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:

You have invisible characters in the html elements, try typing them instead of copy-pasting. See in the image below:

Thanks, that was really helpful.