Tell us what’s happening:
what seems to be the problem with my code?
Your code so far
function convertHTML(str) {
var temp = str.split('');
for (let x = 0; x < temp.length; x++) {
switch (temp[x]) {
case '>':
temp[x] = '<';
break;
case '&':
temp[x] = '&';
break;
case '>':
temp[x] = '>';
break;
case '"':
temp[x] = '"';
break;
case "'":
temp[x] = ''';
break;
}
}
// :)
temp = temp.join('');
return temp;
}
convertHTML("Dolce & Gabbana");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3223.0 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/convert-html-entities