Tell us what’s happening:
As far as i can tell this code is working, but it fails all the tests.
Sorry if it just a silly spelling mistake.
Your code so far
function convertHTML (str) {
var replaceChars = {
"<": "<",
">": ">",
"'": "'",
'"': """,
"&": "&"
}
return str.replace(/<|>|'|"|&/g, function (match) {
return replaceChars[match]
})
}
console.log(convertHTML("Dolce & Gabbana."))
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/convert-html-entities/