Tell us what’s happening:
I am showing as passed but its not giving the correct result that is needed from the lab.
Specifically its showing the & < > and not the HTML characters
Your code so far
function convertHTML(str){
let result = "";
const specialHTML = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
};
for (let i = 0; i < str.length; i++) {
let index = str[i];
let replace = "";
if(specialHTML[index]){
replace = specialHTML[index]
result += replace;
} else {
result += index;
}
};
return result;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
Challenge Information:
Implement an HTML Entity Converter - Implement an HTML Entity Converter