function convertHTML(str) {
let char = [{
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
}]
char.filter(function(val){
for(let keys in val){
for(let letter in str){
if(keys == str[letter]){
str = str.replace(str[letter], val[keys]);
}
}
}
});
console.log(str);
// `:)
return str;
}
convertHTML('Stuff in "quotation marks"');
Guys need help this code works for all other test for the challenge expect this one mentioned here.
the output that i get is Stuff in "quotation marks
while the expected output is Stuff in "quotation marks"
the challenge is https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/convert-html-entities