Stuck in convert HTML entities challenge

Hi everyone,

I’m trying to solve the Convert HTML challenge but it gets stuck in a certain test, I have copied the test to try it and I think I get the required output, but still, it doesn’t get a checkmark.

Here is my code so far:

function convertHTML(str) {
 
let split = str.split("");
let replace = function (char,arr) {
  let newStr;
    let chars = ["&", "<", ">","\"","'"];
    let name = ["&amp;","&lt;","&gt;","&qout;","&apos;"]; 
        if(chars.includes(char)) {
        arr.splice(arr.indexOf(char),1,name[chars.indexOf(char)]);
        newStr = arr.join("");
        return newStr;
            } else {
        newStr = split.join("");
        return newStr;
                  }
            }
            let newString = split.map(x => replace(x,split));
            console.log(newString[newString.length-1])
            return newString[newString.length-1];
       }
 
convertHTML('Stuff in "quotation marks"');
 

Thanks in advance.

Mind providing the link to the test?

1 Like

Never mind I solved the problem, I misspelled “quot” I wrote “qout” instead :rofl:
I finished the javascript certification actually, I’m in Front-end libraries.
Thanks for caring anyway, appreciate it.