Https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/convert-html-entities

Tell us what’s happening:
One of the tests is not passing:
convertHTML('Stuff in "quotation marks"') should return "Stuff in "quotation marks""

Here is my code:
Your code so far


function convertHTML(str) {

let newStr =str;
for(let i =0; i < str.length; ++i){
  switch(str[i]){
    
    case '&':
    newStr = newStr.replace(str[i], '&amp;');
    break;

    case '<':
    newStr = newStr.replace(str[i], '&lt;');
    break;

    case '>':
    newStr = newStr.replace(str[i], '&gt;');
    break;

    case '"':
    newStr = newStr.replace(str[i], '&qout;');
    console.log(newStr)
    break;

    case "'":
    newStr = newStr.replace(str[i], '&apos;');
    break;
  }
}
return newStr;
}

convertHTML("Dolce & Gabbana");

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36.

Challenge: Convert HTML Entities

Link to the challenge:

should return: "Stuff in &quot;quotation marks&quot;"
is returning:  "Stuff in &qout;quotation marks&qout;"

do you see the difference?

damn, it was same to me all the time :slight_smile: thanks, getting tired here…