Tell us what’s happening:
Hi. If i remove i pass the lab but the console don’t display what the lab want. With this code, i display what the lab want but don’t pass the lab. How can i display correctly “&” instead of “&”?
Your code so far
function convertHTML(str) {
let empty = "";
for (const i of str) {
if (i === "&") {
empty += "&<ZWNJ>amp;";
}else if (i === "<") {
empty += "&<ZWNJ>lt;";
}else if (i === ">") {
empty += "&<ZWNJ>gt;";
}else if (i === '"') {
empty += "&<ZWNJ>quot;";
}else if (i === "'") {
empty += "&<ZWNJ>apos;";
} else {
empty += i;
}
}
return empty;
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Challenge Information:
Implement an HTML Entity Converter - Implement an HTML Entity Converter