DEV Community

Oscar Hernandez
Oscar Hernandez

Posted on

HTML entities FCC intermediate algorithms

published: true

tags: replit, nodejs

function convertHTML(str) {
var args = ["\""];
var arr1 = str.replace("&", "&").replace("<", "<").replace("<", "<").replace(args, """).replace(args, """).replace(">", ">").replace("'s", "'s");
console.log(arr1)
return arr1
}

convertHTML("Dolce & Gabbana");

convertHTML("Hamburgers < Pizza < Tacos");
convertHTML("Sixty > twelve") ;
convertHTML('Stuff in "quotation marks"');
convertHTML("Schindler's List");
convertHTML("<>");
convertHTML("abc");
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/convert-html-entities.

Top comments (0)