Hello ) It seems the function i have written works well but still can not pass quiz

Hello ) It seems the function i have written works well but still can not pass quiz
0
function convertHTML(str) {
 let newArr = str.split('');
newArr.forEach(function(element , i) {
console.log(element);
  if (element == '&'){
    newArr[i]='&​amp;';
  } else if (element == '<') {
    newArr[i]='&​lt;';
  } else if (element == '>'){
          newArr[i]='&​gt;';
  }else if (element == '"'){
          newArr[i]='&​quot;';
  } else if (element == "'"){
          newArr[i]='&​apos;';
  }

});
 let res = newArr.join('');
  console.log(newArr.join(''));
  return res;
}

convertHTML('Stuff in "quotation marks"');

Make sure to manually type out the replacement values. It appears you have copied and pasted from a source which has hidden characters in them.

I am sorry ,but I not understand you … this is my own code

You need to retype out the replacement values, because you definitely copied them from a source which contains hidden characters. If you retype them out manually, you will see that your solution will pass.

1 Like

Thank you):grinning: