Hello. The code editor is rejecting my code; however, I feel it should pass all the tests. Could someone help me pinpoint what’s wrong? Thanks!
function convertHTML(str) {
// :)
let html = [['&', '&'], ['<', '<'], ['>', '>'], ['"', '"'], ["'", ''']];
for (let i = 0; i < html.length; i++) {
for (let j = 0; j < str.length; j++) {
if (str[j].includes(html[i][0])) {
str = str.replace(html[i][0], html[i][1]);
}
}
}
console.log(str);
return str;
}
convertHTML("Sixty > twelve");
convertHTML("Dolce & Gabbana");
convertHTML("Hamburgers < Pizza < Tacos");
convertHTML('Stuff in "quotation marks"');
convertHTML("Schindler's List");
convertHTML("<>");
convertHTML("abc");
Returns:
Sixty > twelve
Dolce & Gabbana
Hamburgers < Pizza < Tacos
Stuff in "quotation marks"
Schindler's List
<>
abc