Implement an HTML Entity Converter - Only #6 passing

Tell us what’s happening:

Only #6 passes for some reason while all the other conversions fail and I have no idea why. Why does this one work while all the others do not??

Your code so far

function convertHTML(string) {
    let result = string.replaceAll("&", "&");
    result = string.replaceAll("<", "&lt;");
    result = string.replaceAll(">", "&gt;");
    result = string.replaceAll("\"", "&quot;");
    result = string.replaceAll("\'", "&apos;");
    console.log(result);
    return result;
}

convertHTML("Dolce & Gabbana")
convertHTML("Hamburgers < Pizza < Tacos")
convertHTML('Stuff in "quotation marks"')
convertHTML("Schindler's List")

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:155.0) Gecko/20100101 Firefox/155.0

Challenge Information:

Implement an HTML Entity Converter - Implement an HTML Entity Converter

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-html-entitiy-converter/a6b0bb188d873cb2c8729495.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hi @thenerdybirdy

To help you debug, console log the length of the result variable after you initialise the variable.

Then do the same thing before the return statement.

Carefully inspect the results for the string “Dolce & Gabbana”.

Happy coding

Ah, I see now! Thank you so much for your help! :smiley: