Tell us what’s happening:
So this code is not working on freeCodeCamp, although I get the right output on repl.it…
Your code so far
function convertHTML(str) {
// :)
let temp = str.split("");
for (let i = 0; i < temp.length; i++) {
switch(temp[i]) {
case "&":
temp[i] = "&";
break;
case "<":
temp[i] = "<";
break;
case ">":
temp[i] = ">";
break;
case '"':
temp[i] = """;
break;
case "'":
temp[i] = "'";
break;
}
}
temp = temp.join("");
return temp;
}
convertHTML("Dolce & Gabbana");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0
.
Link to the challenge: