Converting HTML Entities...Won't go through

Tell us what’s happening:

Your code so far


function convertHTML(str) {
const convertHTMl = {
  "&": "&anp;",
  "<": "&lt;",
  ">": "&gt;",
  "\"": "&quot;",
  "'":  "&apos;"
}
return str.split("").map(letter => {
return [letter.match(/[&<>"']/) ? convertHTML[letter] : letter]
}).join(""); 
}

convertHTML("Dolce & Gabbana");

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:76.0) Gecko/20100101 Firefox/76.0.

Challenge: Convert HTML Entities

Link to the challenge:

I can not find out what is wrong with my code. Could someone please help? Thank you very much!

Maybe try console.log() to see what the output is.

Have a close look at your const declaration. There are a few typos.

1 Like

i got it! Thank you very much for your assistance :+1: :blush:!