Hey fellow Campers,
I am wondering what seems to be the issue with my code, what the console prints seems to match what the tests are asking for, but they fail.
function convertHTML(str) {
// :)
let rep = { "&": "&", ">": ">", "<": "<", "\"": """, "\'": "'"};
let a = str.replace(/[&|>|<|\"|\']/g, element => rep[element])
return a;
}
convertHTML("Dolce & Gabbana");
convertHTML("Hamburgers < Pizza < Tacos")
convertHTML('Stuff in "quotation marks"')
convertHTML("<>")
The console prints:
Dolce & Gabbana
Hamburgers < Pizza < Tacos
Stuff in "quotation marks"
<>