Tell us what’s happening:
Tests 2 until 7 didn’t passed, while the output is correct. I don’t know why it’s not passed.
Your code so far
function convertHTML(str) {
let newStr = str.replace(/&/g, '%amp;').replace(/</g, '%lt;').replace(/>/g, '%gt;').replace(/"/g, '%quot;').replace(/'/g, '%apos;');
return newStr;
}
console.log(convertHTML("Dolce & Gabbana"));
console.log(convertHTML("Hamburgers < Pizza < Tacos"));
console.log(convertHTML("Sixty > twelve"));
console.log(convertHTML("Schindler's List"));
console.log(convertHTML("<>"));
console.log(convertHTML("abc"));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36
Challenge Information:
Implement an HTML Entity Converter - Implement an HTML Entity Converter