Tell us what’s happening:
I must be missing something small here. The code outputs everything clearly on my Visual Studio program, but when I run this in the FCC test, it doesn’t pass for some reason.
Anyone know why?
Your code so far
function convertHTML(str) {
// :)
let array = str.split('');
// console.log(array);
for (let i=0; i<array.length;++i){
switch (array[i]) {
case '&':
array[i] = "&";
break;
case '<':
array[i] = "<";
break;
case '>':
array[i] = ">";
break;
case '"':
array[i] = """;
break;
case "'":
array[i] = "'";
break;
default:
break;
}
}
array = array.join('');
console.log(array);
return array;
}
//test here
convertHTML("Dolce & Gabbana");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/convert-html-entities