help wanted
Description
Describe the Issue
We have a challenge that asks campers to replace symbols like & with the relevant HTML entity &. It's a neat little challenge, BUUUUUUT...
The in-app console we render sanitises the entities back to HTML. So with correct code, campers still see & instead of &.
Affected Page
Steps to Reproduce
- Go to https://www.freecodecamp.org/learn/full-stack-developer/lab-html-entitiy-converter/implement-an-html-entity-converter
- Enter the following code.
- Open browser console.
- See different results.
function convertHTML(str) {
let newStr = "";
for (let char of str) {
if (char == "&") {
newStr += "&";
} else if (char == "<") {
newStr += "<";
} else if (char == ">") {
newStr += ">";
} else if (char == '"') {
newStr += """;
} else if (char == "'") {
newStr += "'";
} else {
newStr += char;
}
}
return newStr;
}
console.log(convertHTML("Dolce & Gabbana"));
Expected behavior
The in-app console should render `Dolce & Gabanna
Screenshots
No response
System
Irrelevant
Additional context
https://www.reddit.com/r/FreeCodeCamp/comments/1ovgdgm/current_javascript_version_autoconvert_makes/