Convert HTML Entities not passing test

Tell us what’s happening:

Only the last test is passing. everything else appears to be returning the correct result … I cant understand why this is not being accepted…

Your code so far

function convertHTML(str) {
      str = str.replace(/&/, "&​amp;")

     str = str.replace(/>/, "&​gt;")

     str = str.replace(/</g, "&​lt;")

     str = str.replace(/"/, "&​quot;")
     str = str.replace(/'/, "&​apos;")

  return str;
convertHTML("Dolce & Gabbana");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0.

Link to the challenge:

If you copied/pasted the replacement html values, then they probably have hidden characters which are throwing off the tests. Try manually typing out each replacement string and I bet you pass the challenge.

1 Like

Wahey, yeah it does ! thanks for that :slight_smile: